Skip to main content
Engineering LibreTexts

8.15: Checking to Disable Invulnerability

  • Page ID
    14633
  •         # Check if we should turn off invulnerability
            if invulnerableMode and time.time() - invulnerableStartTime > INVULNTIME:
                invulnerableMode = False
    

    When the player gets hit by an enemy squirrel and does not die, we make the player invulnerable for a couple seconds (since the INVULNTIME constant is set to 2). During this time, the player’s squirrel flashes and the won’t take any damage from other squirrels. If the "invulnerability mode" time is over, line 3 [134] will set invulnerableMode to False.