Python Turtle Game Interrupted by arrow key press

Please give this game a try and let me know if you can help me prevent the animations from lagging or stopping when I use the arrow keys.
Thanks in advance!

https://replit.com/@WSSjw/Airplane-game

I can’t seen to make this game work so that pressing the arrow keys (too many times) or (holding them down) cause the other animations to lag or stop completely…any help would be greatly appreciated. Thanks in advance!


https://replit.com/@wss-computer-programming/New-turtle-game-2022#main.py

code snippet

Hi @JWatWSS I combined these two topics together as you were asking the same question twice. The first link works so I forked a copy of it.

Firstly I think the reason your game is lagging is because of the library you are using. Python Turtle is not built to make games with so I’d definitely expect slower response that you would get with, for example, Pygame. I’d really recommend you check that library out as you’ll be able to create your game with Pygame and get a better performance at the same time.

Someone attempted a similar game a while back and had the same issue. I spotted this thread Python Turtle Graphics Game Lagging - Stack Overflow which might help you understand what is going wrong with your current code.

I hope this helps you solve the performance issues with your game.

Hi Ian,

Thanks for your reply. I figured this might be a issue with trying to do (too much) with Python Turtle. Seems like I’m seeing less and less game projects being attempted this way.
Unfortunately, I have a few lesson’s that ask students to make simple games using that Library. Maybe I will try to learn some Pygame.

Thanks again for your attention.

JW

1 Like