How do I allow only one input in a set time?
I have a timer running and a randomized prompt about what button to press. On a correct press, a counter goes up. A wrong press makes the counter go down.
My trouble comes up when I try to find a way to disable button mashing the correct button for extra points. If I set a correct (or incorrect) button press to reset the timer, the timing appears to overlap with the new current button press, resulting in the total screen flickering from 0 to 1 then back to 0.
Ideal situation: Button prompt appears > Press correct button > Score goes up 1 > Timer and prompt reset before anything can be pressed excessively
OR
Button prompt appears > Press incorrect button > Score goes down 1 > Timer and prompt reset before anything can be pressed excessively
OR
Button prompt appears > Nothing is pressed > Timer runs out > Score goes down 1
I keep thinking in conditional type terms (if/then/else etc) which does me no good here, so I need a lot of help. I've failed at every goal I've wanted to make so far. I'm feeling rather discouraged and disappointed in myself.
Thank you very much for your help.
-
Depends on the logic you already have... but something to try is to make the button press “pulse” (fire the first frame only). This will mean for any given button press it only fires once (like an “onbuttondown” event.
To turn any signal (constant) into a pulse (once only), use a signal manipulator (found in logic and processing). Change its most to “pulse”. Now it will pulse whenever it receives a signal (such as a button being pressed).
Don’t best yourself up too much. The logic side of things isn’t imperative (one thing happening after another). It’s more on a frame-by-frame basis. Everything powered on a given frame runs for that frame. So it can be difficult to get your head round at first. Keep tinkering and you’ll get it ? -
From my understanding the face button presses are already a pulse signal, but I did try using signal manipulators, both "pulse on input on" and custom pulse at on and pulse at off, but I'm still getting 0-1-0 result on counter.
Currently for cleanliness and organization I'm running my logic through chips for each button, so if the randomizer picks X, only the logic checks for the X button is powered.
Please sign in to leave a comment.