0 votes

i'm gaving an error and i tried everything and it doesn't work
here is my code:

# checks the state of the player aka skin
func skin_change():
    loader()
    if player_skin == 0:
        $AnimationPlayer.play("duck_collision")
        if !is_on_floor():
            $AnimatedSprite.play("duck_jump")
        else:
            $AnimatedSprite.play("duck_run")

    elif player_skin == 1:
        $AnimationPlayer.play("goose_collision")
        if !is_on_floor():
            $AnimatedSprite.play("goose_jump")
        else:
            $AnimatedSprite.play("goose_run")
Godot version 3.5.1
in Engine by (25 points)

1 Answer

–1 vote

It's difficult to answer because you don't say which line has the error, but either $AnimatedSprite or $AnimationPlayer doesn't exist relative to the node which has this code.

by (1,053 points)

the error is at "$AnimationPlayer.play("duck_collision")"

It's $AnimationPlayer then.

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 Frequently asked questions and 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 [email protected] with your username.