Controller

Obj: controller

Game Start

Create a new object controller, no sprite. First thing we'll do is make sure that whenever we start the game, we have 5 lives and reset the score to 0.

No more lives

When the player runs out of lives, we need to let them put their name in the high score table and restart the game.

next room

If we want to skip levels when testing our room designs, we want to be able to use the "N" key. Start by adding event for letter N

We need to check there is a next room first. If there is, go to the next room. If there are no more rooms, restart the game.

restart room

If we get stuck, we can hit the "R" key to restart the room (but with a penalty of 1 life).

  • Set Lives: make sure it's relative to -1 so it goes down by 1 life
  • Restart Current Room

draw score panel on bottom

Now we will add the Draw event to have our score and lives showing at the bottom of our rooms...

On the last action panel, add the following actions:

  1. Set Color: this is the color for the text - make sure it's a color that shows up against your room background
  2. Set Font: choose one of the font types in the list
  3. Draw Text: type in "Lives:" in the text box, set X to be "250", and relative.


Now go to the action panel for Score & Lives...

  • Draw Score: just leave defaults but check relative
  • Draw Lives as Images: choose one of the life sprites and set to X "350" and relative.


Your Draw event should look like this...

add controller to room

Go into your testing room and change the height to "512".

Then place the controller object at the left of the new row at the bottom...

Test it out - you should have something like this when playing your game...

Make sure everything works. If it does, you can get it checked off.