why an i getting "Too few arguments for "_keyboard_only()" call. Expected at least 1."

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ceo-Potato

why an i getting “Too few arguments for “_keyboard_only()” call. Expected at least 1.”
i have a coustom function(_keyboard_only) when i try to use it it gives me an error

func _physics_process(delta: float) -> void:
	# Vars
	var velocity := Vector2()
	
	if Control_mode == 2:
		_keyboard_only()
	
# Controlles
func _mouse_only():
	if (Input.is_action_pressed("Left_Click")):
		_move_to_mouse()
		_look_at_mouse()

func _keyboard_only(delta):
	var add_velocity = Vector2.ZERO
	var rotation_dir = 0
:bust_in_silhouette: Reply From: Gluon

You have specified an argument for your function called delta. If you want to pass delta into the function you will need to do so like this

_keyboard_only(delta)

also just an fyi but its best practice not to use a _ at the start of a custom function. This normally indicates a godot built in function.

thanks! it works

Ceo-Potato | 2022-01-05 13:18