Hardware Reference
In-Depth Information
2. The set size is a new command. This allows you to make the sprite bigger or
smaller. Experiment with the size until you are happy with how it looks. You can
also change this to affect the difficulty of the game. If you don't see the hole in the
middle of the wall, it maybe because the size is set too high.
3. Then, set
y
to
0
, which puts the wall right in the middle of the screen, and
x
to
300
, which moves it off the screen to the right.
4. Set the
pipeX
variable to
300
. We will use that variable later.
5. In our forever loop, subtract 1 from
pipeX
. Then check whether
pipeX
is less than
-240
. This allows us to check where it is on the screen. If it is less than
-240
(which puts the pipe to the left of the screen), reset the position of the pipe to the
far right, by setting
pipeX
back to
300
. Then, change the costume to the next one.
6. Finally, set the
x
position of the pipe to
pipeX
. We now have a scrolling pipe!