Answers for "godot input controls"

1

godot input controls

# Setting up controls:
# 	Project > Project Settings > Input Map (tab) >
# 	Action: {action_name here} > Add (button)
# The action shows up in the list, click the cross
# to select controls to link to the action (Keyboard, Joystick, Mouse)
# multiple controls can map to a single action

# The following functions return true or false and should be checked
# either during _process, _physics_process, or _input, callback methods

    Input.is_action_just_pressed("action_name") #first frame pressed
    Input.is_action_pressed("action_name") #every frame
    Input.is_action_just_released("action_name") #last frame pressed

# _input methods only seems to occur once during the just_pressed event

#example:

func _physics_process():
	if Input.is_action_just_pressed("jump"):
    	beginJump()
	if Input.is_action_pressed("jump"):
    	jumpHold()
    if Input.is_action_just_releassed("jump"):
		endJump()
Posted by: Guest on April-22-2021

Browse Popular Code Answers by Language