Goal:
We will now continue the obstacle spawn code.
This last portion will control the random spawning, the movement to the left, and adding a point to the player’s score if they pass through.
Steps:
-
- Click Motion and drag a got to x y block into the forever loop.
- Set the number in the x part of the go to x y to 2400.
- From Operators, place a pick random 1 to 10 block inside the y part of the go to x y block.
- Change 1 and 10 to -45 and 40 inside the pick random block.
- From Control, place a repeat until block inside the forever loop.
- From Operators, place a less than block inside the condition of the repeat until block.
- From Motion, place a x position block on the left side of the less than block and type -200 into the right side.
- From Motion, place a change x by 10 block into the repeat until block and change 10 to -5.
- Lastly, from Control, place a change highscore by 1 block after the repeat until block as the last block in the forever loop.