Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+2 votes

When I hit escape to end the game, sometimes it will end the game right away, sometimes it takes many hits, and sometimes it never ends up ending the game. The code I have that causes the end of the game is as follows:

if window.checkKey() == 'Escape':

        envelopes = gameOver
        window.close()
        return False

The envelopes part ends the loop of moving the envelopes. But this if statement is inside that while loop. Any suggestions would be great!

asked in CSC201 Spring 2021 by (8 points)

1 Answer

0 votes
answered by (302 points)
0

I am still having troubles with it. Even when i set key == 'Escape' it still takes a few hits to get the game to quit and sometimes it won't even end the game still

...