0 votes

why an i getting "Too few arguments for "keyboardonly()" call. Expected at least 1."
i have a coustom function(keyboardonly) 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
Godot version 3.4.2
in Engine by (17 points)

1 Answer

+1 vote
Best answer

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.

by (1,373 points)
selected by

thanks! it works

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.