gmail aprekates wrote:
The problem i get with the following code is that the rect moves as if i pressed a key more than one times.
For me, it works the way I would expect from the code, i.e. the rect continues to move as long as an arrow key is held down. If instead you want it to move one step each time you press a key, it would be better not to use get_keys at all, and just drive it from key events, the way you're handling the space key.
But is vague how that 'state' is created, accessed and how it's changed.
It returns a map telling you which keys are being held down at the moment you call it. That's what it means by 'state'. -- Greg