Medium badge

Pixel Master Public


Demonstrated advanced mastery of PixelDisplay by creating a two-level starfield with parallax scrolling.

Required Evidence

Submit your "parallax starfield" program

A static image can't do this program justice, so please submit the code for your program instead. More Info

Badge Overview

Parallax scrolling is a common animation trick that produces an illusion of depth by having different layers of graphics scrolling at different rates.  The more slowly-moving layers appear to be further away.  For this badge, you're going to use this trick to create a parallax-scrolling starfield.
Create a Mini Micro program that does the following:
  1. Sets display(6) to pixel mode in addition to the standard display(5). 
  2. Clears both displays to color.clear, with a size of 960 pixels wide and 1280 (i.e. 640*2) pixels high.
  3. Defines a function to draw 500 randomly-colored stars on a given display, using setPixel.
  4. Uses that function to draw stars on both display(5) and display(6).
  5. Enters an infinite loop which (a) scrolls display 5 in Y by 2 pixels, wrapping back to 0 at 640; (b) scrolls display 6 by 1 pixel, also wrapping at 640; and (c) yields.
When run, you should see two different layers of stars, scrolling down the screen at different rates.  Submit your program to earn this prestigious badge!

Badge Experts

Badge Learners