Step 1: Variable Setup

Goal:


The first thing we’re going to have our game manager do is set up some variables for us at the start of the game.

A variable is something that holds a piece of information that we can use many times in our code.

The Gameover will be set to 0 or 1, if it is 0 then the player can keep playing and if it is 1 then the game will end.

The Score variable will tell the player the score during the game.

The Time Remaining variable will be the timer counting down to zero.

Steps:

  1. Select the backdrop/stage (it is located next to the sprites under the main game window).
  2. From Events place a when green Flag clicked.
  3. From Events place a broadcast block and select new message.
  4. Name this new message “CreateBalloon!” This message will eventually be able to tell the game to create a new balloon at the start of the game.
  5. From Variables place three set to blocks.
  6. On the first set to block, select the variable “GameOver:” and set it to zero.
  7. On the second set to block, select the variable “Score:” and set it to zero.
  8. On the third set to block, select the variable “Time Remaining:” and set it to 30.

Code: