Step 2: X-Wing Lose 1

Goal:


Now that the player has lives, we need to code losing conditions in the game if the player runs out of lives.

We will have our game check to see if we have less than 1 life.

Steps:

  1. From Control, place an IF statement block after the IF statements that we use to move the X-Wing (at the very bottom of the piece of code that starts with when green flag clicked).
  2. From Operators, place a <(Less Than) block in the IF statement and set the right side to 1.
  3. From Variables, place a round Lives block in the left side of the <(Less Than) block.

Code: