c

In this codelab, you'll make a balloon pop game.

What you'll learn

Open the starter project and click Remix.

First, we are going to program the arrow sprite to follow the mouse pointer. We will need to program the arrow sprite so that when the user clicks their mouse (within the game screen), the arrow sprite will move in the direction of the mouse pointer until it reaches the edge of the screen.

Things to Accomplish

  1. Program the arrow end to repeatedly follow (but not go to) the mousepointer.
  2. Program the arrow to repeatedly check if the mouse has been clicked.
  3. Program the arrow to repeatedly move until it reaches the edge of the game screen.
  4. Set the starting location of the arrow and have it return to this same spot once the arrow has reached the edge of the screen.
  5. Play a sound effect when the mouse is clicked.

Now we will add a 30 second timer and score to the arrow sprite.

Steps

  1. Create a new variable for "Score".
  2. When the game begins, initialize the "Score" variable and reset timer (remember Hat blocks!).

  3. Shrink the arrow to 15% of its size. (Why do you think we need to do this?)
  4. Start the arrow at the center bottom of the page.

  5. Repeatedly run the arrow control code from the previous page until 30 seconds is up.

  6. Display the final score. The score at this point should still be zero. Why is that?

Next we will create 10 clones of the balloon sprite.

Things To Accomplish

Challenge

Now, all you need to do is make the code for each balloon clone.

Steps

  1. When a balloon clone starts, position the balloon clone within the top half of the screen and make the balloon visible.
  2. Repeat this code forever for the cloned balloon: (Why forever? Why not "repeat until"?)
    1. Move balloon slowly to the right.
    2. If the balloon is hit by an arrow, increase the value of the score variable, play a sound effect, and pick a new random position for the clone.
    3. If the balloon reaches the right edge of the stage, pick a random position on the left side of the stage and change costume.
When you're finished, be sure to save and share your project, and then add it to the studio:
  1. Giga studio .
  2. Nano studio .