Event Inputs are not working.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Lynn_Len
:warning: Old Version Published before Godot 3 was released.

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()
	s.set_pos(Vector2(0,-64))
	add_child(s) 

this is for spawning the reticle.

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

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"):
	print("Up")

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

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

willnationsdev | 2017-10-18 01:26

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

Lynn_Len | 2017-10-18 03:55

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

eons | 2017-10-19 01:02

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

Lynn_Len | 2017-10-19 01:24

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.

aozasori | 2017-10-19 08:06

i got it working thank you.

Lynn_Len | 2017-10-19 20:23