I want to make a reflex game where you have to press the right arrow key when the button shows up on screen.
There is a penalty if you press the wrong arrow, and I also want to trigger it when the player press any other key on the keyboard.
I tried to use event.ispressed() in a function _unhandledkeyinput(event), BUT the thing is that event.ispressed seems to be true not only when a key is pressed, but also when it is long pressed or when it is released.
here is my function :
if etat==etats.ATTENTE and event.is_pressed():
print("not an arrow...")
etat = etats.VERIF
the functions test() is meant to test if an input is right (and I think this part of the code works well). The function faux() is called to show a feedback to the player that it's wrong and change the arrow.
About the outputs I am getting :
- When it says "RIGHT" "LEFT" "UP" or "DOWN", it was always what I typed.
- sometimes, even with a brief press in the good direction, it prints the good direction and "not an arrow"... But not each time !
- when I press multiple arrows, it prints the directions and "not an arrow" sometimes
- when I press an other key, it prints "not an arrow"
I hope I am clear enough !