02. Animate Propulsion

Image (Original Source)

In this step, we will create a ship propulsion animation.

Start by modifying the ship we drew in the last step.

Tip: Press up to shift the ship up a pixel. This will give you the space you need to add the jetstream pixel without having to redraw the ship!

Now create a second ship where the jetstream pixels swap.

Enter this code on tab 0 in the code editor.

 
t=0
function _init()
cls()
ship={sp=1,x=60,y=60}
end
function _update()
t=t+1
if(t%6<3) then
ship.sp=1
else
ship.sp=2
end
end
function _draw()
cls()
spr(ship.sp,ship.x,ship.y)
end
 

Hit ctrl-r to run the game. A ship will appear with an animated jetstream!

End Result

Download