0 votes

My Code:

animationPlayer = $animationplayer

if Input.is_action_pressed("WASD_d"):
    animationplayer.play("RunLeft")

The error:

attempt to call function 'play' in base 'null instance' on a null instance

in Engine by (33 points)

And i use:

Func _physics_process(delta):

2 Answers

0 votes

Show screen node

by (334 points)

Page not found

There seems to be a problem with using

$

But only if the node with the script is saved as a scene

I tried using the exact same code on a node not saved as a scene and it works fine

A workaround might just be to Put a node2D on the top of the tree and then the kinematic body connected to it

I tried the workaround and it did not work

but now i found out all of my old

$

in the same code such as

$Hitbox

still works

however i tried to reset them and they stopped working

this pretty much confirms it to be a glitch and not something that i do wrong

and its only in that project too

+2 votes

animationplayer

by (68 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 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.

Categories