The goal of this game is to move the diver to the balloon as many times as we can. We must avoid the falling monsters at all costs. Our diver will have a special skill of shrinking and growing when the player pressed the up and down arrows.
Every time we touch the balloon we will get an extra point.
We should add the above sprites to our game. We use the drawing tools to build a nice sea water line.
Use the shrink tool to make the sizes a nice fit for the game.
Let’s start by making our diver move, make sure the diver sprite is selected.
We want our diver to shrink and grow:
Next we want to move across the screen:
We would like to randomly place our monsters and have them fall-down to the bottom of the screen. Be sure to select the monster sprite.
We want to have lots of these monsters falling down, so we are going to use clones to achieve this.
To start with:
This code will create a monster clone every 1 – 10 seconds.
Now once our clone has been created, we must add the code to make it fall until it touches the bottom of the screen.
First we make sure that we select a random position along the X (across) axis.
Next we point the monster looking downward.
We then repeat until we touch the edge of the game, which is the perfect time to delete the clone.
We use a random block to make sure that our monster is moving randomly, this makes our game a little more unpredictable.
Add a new variable called ‘score’, this will add some new blocks that we can use:
Select our diver sprite again, we are going to be adding some code to test when our diver touches either the monster or the balloon.
We have two test in our code, the first checks to see if the monster has been touched:
This check will stop the game and show a backdrop that I created that has ‘Game Over’ written on it.
The code also includes a nice colour change effect that hits the player.
The second test will move the player to the other side of the screen when they hit the balloon and give them a point.