Goal:
Now that we’ve coded the ability for a balloon to appear, let’s code how they should behave (otherwise they would just stay in one spot the whole game!).
We will want our balloons to constantly go up (positive y direction) until they either get clicked by the player (which we’ll do next) or if they hit the top of the screen.
After this step we’ll have seen if “ballonPopped” = 1 twice. What does this if statement mean again? If you’re not sure check Step 1 for a quick hint!
Steps:
- From Control, place a repeat until block under the if then block from the previous step.
- From Operators, place an “=” block inside the repeat until block.
- From Variables, place a round “balloonPopped” block on the left side of the “=” block.
- On the right side of the “=” block type in the number 1.
- From Motion, place a change y by block inside the repeat until block.
- Inside the change y by block, type in the number 6.
- From Control, place an if then block underneath the change y by block.
- From Operators, place a “>” block inside the if then block.
- From Motion, place a round y position block on the left side of the “>” block.
- On the right side of the “>” block type in the number 180.
- From Variables place a set to block inside the if then block.
- Set it to the variable “balloonPopped” and the number value to 1.
- From Looks, place a hide block underneath the set to block.
- From Control, place a wait block underneath the repeat until loop, be sure it says 1 seconds.
- From Events, place a broadcast block. Set its message to be “CreateBalloon!”