Action.pressed or action_id == hash("touch")?

Hi,

I wanted to know the difference between, in on_input, looking at action.pressed being true or false, and at action_id having “touch” action hash.

I have Game Objects, and now GUI boxes (a click on a star open a Gui.go that show details on the star).

Is it better to use one or another ? Or the two ?

See this:

These are different concepts. One tracks what is happening to a given button, e.g. action.pressed means the button was pressed this frame, whereas action.released means the button was released this frame. action.pressed and action.released has nothing to do with WHICH button was pressed or released. That’s what action_id is for. In your example that is “touch”, but might be “key_a” or “key_left” or “key_space”.

They are different.
action_id == hash("touch") will happen many times while you are touching
action.pressed just happens once at the time you start touching. (This variable is not only used for touches, when you type, mouse click…)

I think I understand, than you.
I’m see what I have to rewrite to take advantage on it (I understand now why I had to put a variable to stop the 7-8 on_input reactions when I clicked on a star).