Step 2: Spawning Balloons

Goal:


Now that the little bit of setup is done, let’s start with making balloons appear.

We’ll also add in some randomness so they don’t always spawn in the same place.

Steps:

  1. Stay on the balloon01 sprite.
  2. From Events, place a when I receive block and set the message to “CreateBalloon!”
  3. From Control, place an if then block.
  4. From Operators, place an “=” block inside the if then block.
  5. From Variables, place a round “balloonPopped” block on the left side of the “=” block.
  6. On the right side of the “=” block type in the number 1.
  7. From Variables place a set to block.
  8. Set it to the variable “balloonPopped” and the number value to 0.
  9. From Motion place a go to x/y block.
  10. From Operators place a pick random to block on both sides of the go to x/y block.
  11. In the left pick random to block type in the numbers -240 and 240.
  12. In the right pick random to block type in the numbers -70 and -180.
  13. From Looks place a show block.

Code: