Space Bat Tutorial - Step 5
5. Finishing touches
- Challenge: How do we create a collision between the enemy and the Space Bat?
- Challenge: How do were reduce the lives when the alien collides with Space Bat?
- Challenge: How do we end the game when lives are gone?
Hint: We have already done similar steps.
Collision between Space Bat and Aliens
Let’s make a collision between Space Bat and the Aliens to make things a little harder.
The first step is to make a New Condition so go ahead and click the New condition box. In the box that opens select the Alien and choose Collisions and then Another object.
The object we want to collide with is Space Bat so we need to click on Space Bat in the box below, and then click OK.
Destroy the enemy Aliens
You will have now created a new rule like the one below.
All we need to do now is destroy the enemy when they hit us. Right click the Alien box and select Destroy.
Remove a Life
The next step is to remove a life from Space Bat each time he is hit. In the rule right click the Joystick icon and select Number of Lives and select Subtract from number of lives.
In the box that opens up, add the number 1 and then click OK.
Press F8 to test your game and you will see you lose a life each time the Alien hits Space Bat. However, the game does not end when we run out of lives so this is our next task.
End the Game
Click New condition to make a new rule and this time select the Joystick icon and then select When number of lives reaches 0.
You will have created a rule like the one below.
Click the Chess Board icon and select End the application.
We have now completed our first simple game.
In later lessons we will learn new features like High score tables, into screens, sounds and levels.
Keep a copy of Space Bat so that you can add all these new features in the future.
Spread the word!
You can share this document using the following buttons.