Step 4: Creating a Minimum Score

Goal:


Now that we have coded the lives in our game, we also need to ensure that our players can realistically reach the boss and win the game.

Our boss is only triggered when the player reaches a score of higher than 10, but they can always lose points when they are hit by an enemy or if the enemy reaches the bottom of the screen. This means that our players can get negative scores and get further and further away from the end of the game.

Let’s make sure that the player can only go down to a certain score in the game.

Steps:

  1. From Control, place an IF statement block under the IF statement we used to check out lives count.
  2. From Operators, place a <(Less Than) block in the IF statement block, and set the right side to -10.
  3. From Variables, place a round Score block in the left side of the <(Less Than) block.
  4. From Variables, place a set to block inside of the IF block.
  5. Set the variable to score and the amount to -10.

Code: