Under review

"If key just pressed" clause doesn't work

Dornano 4 months ago in Game Creator updated 4 months ago 13

In a condition, the "Keyboard" clause seems to not working well.

If the state is "Being pressed", it works. But if it's "Just pressed" (same as "On key down" I guess?) it doesn't works.

(in my case, this condition is children of a "On Tag enter" Trigger)

Unity version:
Game Creator version:

Yeah I saw this in the hub. And indeed the "Being pressed" state is working, but not the "Just pressed", which is the one I would like to use :o

did you also tag the parent?

and also

exactly what is it you want to happen

there is also a player on enter key trigger that means the key will only react if the player is in the trigger

This is exactly what I would like to do (from 1:20) :

See? The player has a line in front of him, and if the line enters in a trigger (like a door, or something to examine) + if the Player press E (2 clauses), then an action is launched (open the door, display a message...).

Th Player don't have to be inside the trigger. But his line, yes.


you could just put a new collider onthe player, set it in front of the player and set it as trigger.

Then you would have conditions on that trigger player enter tag and have tags on things you want the player to react with.

on player enter tag pickup

.....then...do some action

pn player enter tag doors

.....then...do some action

on player enter tag books

.....then...do some action

Under review

Not sure if this is the case, but remember Conditions are just checked once every time the Trigger fires them. So if you have On Tag Enter, it will only check it once when the tag object enters the collider. Just one frame, not while the object stays inside.

Oh ok ok ! I was not aware of that, sorry.

Well, thanks both of you for your great help ! I managed to achieve what I wanted to do, after failing since weeks ^^;

Just in case someone would be interested, here is how I've done:

-I put a long invisible cube in front of my player with a "examine" tag.

-In front of my door, or object, anything I want an interaction with, I put a trigger with "On tag enter" set to "examine". When this tag enters, it sets a bool variable to True.

-Another trigger with "On tag exit" sets the bool variable to False.

-And a third trigger with "On Key down" on E, which refers to a condition: if the bool variable is true, it displays a message.

And voilà ! Now, it works exactly like in the video upwards. :D

Oh, Ok, that is actually how you standarly do it. I thought you wanted something different. But anyway you got it now working as you wanted it to be. Guod luck and have fun on your project. Any questions? we are all here to help and learn.

Yeah, this is the result:

Show message only when facing the door.mp4

See? I show the message only when the Player face the door. If I hit E key while I face in the other direction, it doesn't display the message, even if I am inside the trigger. That's why I needed this invisible cube with a tag ^^

Hi thanks, but I never download or open picture or video files from other sources. you could use youtube or a quick way is using streamable.com which give you 10 minute videos

Ah I think I understand. However, wouldn't it be better if the player rotated towards the door and then displayed the message? You could simply add a "Marker" where the arrow faces the door and in the Actions, before displaying the message, use the "Move Character To" to the Marker. That way you make sure the player faces the object.

Yeah, that's what I've done in a first place ^^ But I didn't want the Player to be able to show the message when he's not in front of the door. Otherwise, it sounds unnatural I think.

No need of a Marker in fact, but indeed, I just added the "rotate towards" Action. Good idea, thanks ^^