Animation with code not working T-T

Godot Version

4.4

Question

Hello! Im currently working on a vampire survivors type game and for some reason the code im using isnt working. It keeps flashing me errors and I’m genuinely at a loss as to what to even do to fix it

heres my code

Those commands need to be inside a function.

You have:

func _physics_process(_delta):
    [...stuff...]

# function ends here

if Input.is_action_pressed("ui_right")
[...stuff...]

You need:

func _physics_process(delta: float):
    [...stuff...]
    if Input.is_action_pressed("ui_right")
    [...]

Or:

func _physics_process(_delta: float):
    [...stuff...]

func _process(delta: float):
    if Input.is_action_pressed("ui_right")
    [...]

Or:

func _physics_process(delta: float):
    [...stuff...]
    _do_my_stuff(delta)

func do_my_stuff(delta: float):
    if Input.is_action_pressed("ui_right")
    [...]
2 Likes