I’ve seen that recently there was a new event added called “key was just pressed”. This saved a lot of the headaches with making the game feel “snappy”. Before that you needed a trigger once and then an additional wait aciton if you didn’t want it returning true after it resets when a key was held down.
I’d personally like the same feature for mouse buttons and touch aswell
Why would you need a wait action? If the conditions are “key is pressed” and “trigger once while true”, then the event will only action once while the key is pressed. This is the method I use to run an action when the key press has just started. There is no need for a wait.
Key pressed, animation plays
Animation or the action finishes and returns back to the old animation
If you’re still holding the key, it plays again
Without just pressed you need to add a wait timer (i do .001 seconds for non-noticable delay) or just make the key press released instead (which adds “input delay”) Some mechanics just break if you don’t add that. For an example one of my games puzzles used this before the update because the animation would just get stuck if you held the key at the time the animation returned back to neutral.
It might not be needed on simple stuff but on advanced stuff does need it. My guess is that the engine itself does the said .001 wait command on the just pressed event along with the trigger once aswell. So it just saves you 2 lines of code.
I just realised you originally asked for the “key was just pressed” feature but for mouse buttons and touch.
Can I ask that when you post a request, you put in what you are after first, and the explanation following it? It’ll saves people like me, too lazy to read the full post, from missing the actual guts of the request
I still don’t understand. A was pressed would be the same as a pressed with a triggered once.
A bit of context. It could be the other conditions that are resetting the trigger once. Otherwise, you might need to use a boolean variable to track a state.
Let’s say you used
Mouse is pressed
Cursor is on an object
Trigger once
The trigger once would be reset or removed when either condition went from false to true and the back to false.
In this example, you could add a boolean state or move the trigger once so it’s directly below the mouse condition.
Mouse is pressed
Trigger once
Cursor is on an object
This isn’t the same. The trigger once wouldn’t be removed if the cursor was no longer on the object.
All I want is to eliminate the trigger once just like what has happened recently for key just pressed, so that we can just have mouse pressed, cursor on object. In fact, if I had made the request, I would have said can we have an action that is mouse is clicked on object. Just one beautiful action instead of three. I didn’t try to understand the OP’s wait stuff.
Zero, I don’t understand whether you are for or against the idea. As for
I have found that even though key released should be an inbuilt once event, a trigger once is needed.
But if anyone says the actions list is getting too clogged with pressed, just pressed, and all the others, I’d agree with that too. But I just get tired of adding trigger once so often
I assume that means you support it. So far I’m the only person to have given the request a heart. I assume the devs notice things like that if they’re prioritising things.
I have no idea how you could get anything else from my words
I am always in for unifying stuff
Why we have Random()
But we have round() not Round()
Or mod() not Mod()
90% of expressions as 1st word capital
WTF
Anyway maybe to be more precise i am always IN for any change that will leave less room for confusing users
Having same set of conditions for mouse buttons as for keyboard would just make perfect sense
Also i think we should vote for different names
For example it should not be key pressed and key JUST pressed and
It should be
Key Held (or Key Down)
Key Released
Key Just Pressed (or Key pressed)
BUT 1st should indicate holding it down
Same as we have in button states clicked and pressed
Clicked means released
Pressed means is being held
This would be perfect moment if adding something to unify names
And we only need to remember 1 rule for
Objects / keys / buttons
Instead of each of them have different set of names
also understanding how trigger once works is mandatory to learn how to dev in GD.
Triggeronce is mainly used in keypress events; doing without it means learning late. just keypressed should be used by those who know what they’re doing.
And now that is exactly why i would say let’s change names to
Key HELD
Key PRESSED
or
Key JUST PRESSED
Where pressed/just pressed
Would be same as in with trigger once when it comes to functionality
BUT that naming would teach ppl that if you are checking if key is held you are doing something as long as its held
When if you would use pressed (i think now JUST pressed makes more sense) is something that happens only once
What @ZeroX4 Said basically. Key just pressed only returns the event once but pressed with trigger once can return again. You also have to add a wait command in-between actions sometimes for it to work. Check one of my older replies above with how i’ve used a wait event before key was just pressed was added :
It just makes stuff easier and less messy. Not to mention quite bit of the newer people on the engine doesn’t really know about the wait command itself aswell so it makes it easier for the beginners too