Basic setup of the game screen
This is very similar to what we did for the Frogger clone. Here is how we will organize the game screen:
We will have a lot of animations in this game; three for the player, three for each of the two enemies' seven tiles, and two background animations. To make things more readable, we will regroup them. The animations for the player and enemies will each be stored in an object literal, and the animations for the tiles will be stored in an array.
Here is an extract of our code:
var playerAnim = { stand: new gf.animation({ url: "player.png", offset: 75 }), walk: new gf.animation({ url: "player.png", offset: 150, width: 75, numberOfFrames: 10, rate: 90 }), jump: new gf.animation({ url: "player.png", offset: 900 }) }; var slimeAnim = { stand: new gf.animation({ url: "slime.png" }), walk: new gf.animation({ url: "slime.png", width...