9.15: Checking to Disable Invulnerability

Making Games with Python and Pygame · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC-SA 3.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    9.15: Checking to Disable Invulnerability
            # 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.


    This page titled 9.15: Checking to Disable Invulnerability was last modified on Mon, 18 May 2020 08:25:02 GMT and is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Al Sweigart via source content that was edited to the style and standards of the LibreTexts platform.