0 votes

Im trying to make a game and one of the things that i wanted to do was have an input event spawn a aiming reticle and then despawn upon release of the of the input; but the problem is that the input isn't responding for some reason.

if event.is_action_pressed("Up_Place"):
    s = Aim.instance()

this is for spawning the reticle.

elif event.is_action_released("Up_Place"):
    var r = get_node("Aiming_Reticle")

this gets the reticle and then despawns it. I tried taking apart the code leaving only the event is action pressed and then added a print function to test the event.

if event.is_action_pressed("Up_Place"):

if doesn't show up in the debugger, can someone help me with this.

in Engine by (41 points)

What notification are you putting this code in? This looks like 2.x code?

im sorry im kind of godot(and game making in general) noob so i don't know what notification your talking about if you mean the key i put in InputMaps then im using the 8,4,5,6 as a sort of second wasd key set

In the input mapping, are the names exactly like that? (upper/lowercase)
And _input is enabled?

no, recently when i put the inputs in they start calling it UP, LEFT, or unknown and yes i'm using the func _input(event) if thats what you mean

You need to call set_process_input(true) at some point or the code in _input will never run. A good place for it is somewhere in _ready.

i got it working thank you.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.