0 votes

extends AnimatedSprite

func process(delta):
if Input.is
actionpressed("uiright"):
$AnimatedSprite.play("walk")
else:
$AnimatedSprite.stop("walk")

The error is : Attempt to call function 'stop' in base 'null instance' on a null instance.
Please help me

in Engine by (12 points)

1 Answer

+1 vote

$AnimatedSprite means "get a node called 'AnimatedSprite' that's a child of this one".

Since your script starts with extends AnimatedSprite, it appears that this script is attached to the animated sprite, not the parent of one.

If that's the case, then you can just call play() and stop() without getting any node.

by (21,979 points)
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.