Time for action – checking for game over
There's going to be more than one way to address our "game over" bug, and that shouldn't surprise you by now. We're going to approach this problem with the forever block.
Let's see what we can do by performing the following steps:
- First, detach the first wait until () block from the script and add the forever block in its place.
- Add two if () then blocks to the forever block because we will evaluate two unique values.
- The first if () then block should evaluate the y position < y position of (paddle) statement.
- Add the change (Lives) by (-1) block to the first if () then block we just added.
- Make the second if () then block evaluate lives = 0.
- Add the stop (all) block to the second if () then block we just added.
- Play the game and allow the ball to miss the paddle, and then watch your lives quickly drop to zero. Now, we've found another bug. The following is a screenshot of our current script:
- This bug can be overcome...