Answer the question
In order to leave comments, you need to log in
How to make the system take into account only the new keystroke?
It is necessary that the system performs an action on pressing a key.
keys = pg.key.get_pressed()
if keys[pg.K_PAGEUP]:
if yellowNumber == 2 or yellowNumber == 3:
yellowNumber -= 1
keys
is updated, in order for the element to move only by 1, you need to press the key for ... 1.67 hundredths of a second, which is physically impossible. And I need to make it so that the system reacts only to a new click
Answer the question
In order to leave comments, you need to log in
Pressed - changed the state of the variable "last button". Held longer - there was a second pressing. We check if the button matches the contents of the variable "last button" - ignore it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question