Trigger [On Key Hold]

Carl Powell 4 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 3

Should not have to re-trigger an On Key Hold Trigger for a condition to re-evaluate its clauses. 

trigger on key hold [left shift]
holdtime = 0
execute = on timeout

triggers the condition below;

clause 1;

 if isOnAir {reset player state}

clause 2;

if isGrounded {set runspeed to 7 && change state animation}

if clause 2 is true and i jump or the character falls, clause 1 is not triggered unless the key [left shift] is REpressed (released and pressed again). 

that logic makes sense for "On Key Down" or "On Key Up", however, for "On key hold", it should be updated every frame that [left shift] is held inside the void Update();

Should not have to retrigger [Left Shift] during OnAir for the condition clause isOnAir to be true && isGrounded to be false.

I hope this makes sense. 
Carl (artesian)

Unity version:
Game Creator version:
Satisfaction mark by Carl Powell 4 months ago

On Key Hold is not meant to update every frame. That's what the "While Key Down" is for. The On Key Hold detects a key press and, after a certain amount of time, if the user hasn't released it, it will execute the Actions/Conditions.


Aah my bad. I consulted the discord before the post to no avail. Sorry to bother. Ill try that. Thanks Marti

No problem! You're welcome! :-D