Step 4 – Fainting Pokémon

Player 1 – Fainting

Our HP Reaches Zero


  • We don’t want to lose right away when one monster faints. We have three, after all! To allow us to use all three, we have to do a mix of calling the function again, eliminating members of our party, and making sure we still have monsters left. Hang on, it’s going to get a little bumpy.
  • First, grab the “on player 2 life zero” Info block and change to player 1.
  • Next, grab an “if true then, else” Logic block and fill it with a “>” block. Set it to “length of array playerTeam > 1”
  • Then add the Variables block “change lives by 1” and make it “-1”.
  • Then add the “set player 2 life to 3” and change to player 1 and “30”.
  • Then add the Arrays block, “list remove value at 0”. Change list to “playerTeam” and fill the 0 with the same “partyPos – 1” as our sprite block.
  • Next, add the “destroy trainer” block.
  • Add the Sprites block “set trainer to…” and fill in with “playerTeam get value at 0.
  • Add hte Sprites “set trainer position to x 32 y 64”.
  • Finally, at the Variables block “set partyPos to 1”.


  • Or Else


  • Since the only change to our lives is making it lower, the else section is going to check for when “lives = 0” be default. In that case, we use the Game block “game over LOSE” to say we lost the game.
  • Player 2 – Fainting

    Their HP Reaches Zero


  • A lot easier than when our HP reaches zero, we just start with a “on player 2 life zero” block from the Info section. First thing inside is to “destroy opponent”.
  • The next step is to place an “if true then” Logic block and fill it with the Logic comparison “0 > 0”. Set the comparison to “length of array enemyTeam > 2”.