I have been developing a game along with the pygame series made by sentdex for thenewboston, this is basically the same code but instead of exiting the game quickly after going OUT of the boundries, it has a long delay. Also, I tried using "if event.type == pygame.K_ESCAPE or event.type == pygame.K_RETURN", none of those keys work to exit. thank you.
Asked
Active
Viewed 34 times
0
-
Please show more source code of yours – Alexander Farber Oct 27 '16 at 08:05
-
i have realized that there isnt a delay but apparently the canvas is much bigger than it is defined. Also i managed to get the keys woking, missed an event, source code here: http://pastebin.com/DrmCQ12j – Gamstar Oct 27 '16 at 09:01
-
cannnot fix canvas, help please? – Gamstar Oct 27 '16 at 11:06
-
in `gameLoop()` use `return` to fast exit this function. I see other problem - when you press `R` then you run `gameLoop()` again - you have recursion - and when you press `ESC` then you leave this `gameLoop()` you returns to previous `gameLoop()` which can need another `ESC`. – furas Oct 27 '16 at 13:36