[Tutor] Event loop logic question
dn
PythonList at DancesWithMice.info
Sat Jun 18 01:14:26 EDT 2022
On 18/06/2022 17.04, Phil wrote:
> Thank you for reading this.
>
> What I'm trying to achieve here is have the word 'stop' printed once
> whenever no keys are pressed and 'forward' printed once even when the up
> arrow key is held down.
>
> I don't think this question needs any knowledge of Pygame Zero to solve
> and it's quite likely that I've misunderstood the logic required. The
> following code is my most recent version which seems to work the first
> time through the loop but fails after subsequent 'up' key presses.
> Debugging the event loop is difficult.
>
> Any hints or alternative methods will be, as always, greatly appreciated.
>
> By the way, this project sends commands to a controller which is easily
> overwhelmed if too many commands are received per second.
You may like to study the games (start with snake) at
https://simplegametutorials.github.io/pygamezero/ to see how they do it.
--
Regards,
=dn
More information about the Tutor
mailing list