Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+3 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 (1 point)

1 Answer

0 votes
answered by (5.7k 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

...