Let's make our ship move. Create program ASHMUPD
and put this in:
That's the sprite for our character. It looks like this:
Now let's code the actual movement. Since our ship's just one ship, we won't put it in an array. We need to keep track of its X- and Y-positions; for simplicity, how about just X and Y? Here's prgmASHMUPK
:
As you can tell, we'll be moving two pixels each frame. It's a good amount.
We haven't given it an initial position yet, so put that in prgmASHMUPI
(the initiation program). The ship should start in the center of the screen, perhaps a closer to the bottom edge. (44, 40) should work.