Goal:
Awesome! We now have a working timer!
However, we still don’t have any moles showing up yet, which isn’t very good. Let’s fix that next!
First be sure you are still coding on the backdrop/stage as all this next code will also go here
This code will choose a random number from 1 to 6 (because we have 6 holes!) and use that to decide where to place a mole
Steps:
- From Events place a when I receive block and set the message to be “MoleDisappeared!”
- From Variables place a set to block
- Inside the set to block on the left side, set the variable to be “positionChooser”
- From Operators place a pick random block on the right side of the set to block
- On the left side of the pick random block, type in the number 1, on the right side type in the number 6
- From Control place an if then block
- From Operators place an = block and place it inside the if then block
- From Variables place a round “positionChooser” block on the left side of the = block
- Type in the number 1 on the right side of the = block
- From Variables place a set to block
- In this set to block, set the variable to be “nextX” and the number to -130
- From Variables place a set to block under the previous one
- In this set to block, set the variable to be “nextY” and the number to 60