Lab = Make it Move
11/8 Update: Significant rework since last revision
- Run the Jaalaga starting code on a device
- Restrict the ships movement to only left and right movement
- Find a ship speed that that is good for the game
- Replace the ship sprite with a better graphic
What You Will Need
- The same setup from Lab = Display Something
- Jaalaga starting code from Git Hub
- Version 0.5
In Lab we setup a development environment. Our development environment at this point includes several software tools, the AndEngine source code and our Android or Kindle Device. Among the code was a project with a wide variety of AndEngine examples. You should have reached a point where you ran these examples on your device. If you did not reach this point you should get Lab working before tackling this lab because it requires a working AndEngine setup.
In this lab we will start to build our game. As we discussed in class, we will be building a game that is similar to the arcade classic Galaga. We can’t use the same name so we will just call our game “Jaalaga”. In Jaalaga you will be piloting a space ship and trying to eliminate the hostile aliens. You ship is fixed to the bottom row of the screen. Your ship can move left and right and can fire two shots at any time. Enemies move in formation and periodically break formation to dive at your ship. All ships are destroyed when they are hit by a missile or collide with another ship. In this lab we will focus of the movement of just the player’s ship.
The images below display the two screens we will see:
Run the Starting Code for the Game
First you will need to get the starting code from Git Hub at the link described above. Add this project to your working setup from Lab. Compile and run the code and you should see the screens above.
Examine TODO Items
The source code for this lab and future labs will be marked with comments that have TODO at the beginning. This lab has three such comments
- JaalagaResourceManager.java (Line 208)
- ManagedGameScene.java (Line 122)
- ManagedGameScene.java (Line 56)
After reading the comments, make changes to the code based on each TODO item. You may have to look up help on AndEngine functions to change the right thing. Feel free to make a guess and verify if your assumptions were correct. When you have completed the three TODO items you have completed Lab.