But whenever the body enters, it returns error.
Attempt to call function ‘play’ in base ‘null’ instance on a null instance.
Am I referring to Player wrongly? Why doesn’t it find it?
Is your Player under your Area2D node? if not…then probably not finding player
lowpolygon | 2020-01-10 09:23
No, it’s not under Area2D, it’s under World.
How do I properly address a node elsewhere?
verbaloid | 2020-01-10 11:23
Try get_tree().get_root().get_node(“player”)
edit: since I don’t know exactly where your area2d is, I am using get_tree().get_root() If your area2D is directly under root node, you can try get_parent().get_node(“Player”)
lowpolygon | 2020-01-10 11:32
I still can’t figure out what’s the right syntax to use these two statements together.
You have several problem
don’t use $player to access the player body instead use body and check if the body is not null and if the body is the player, for checking if body is player you can put player collision mask and area collision mask a same thing
extends Area2D
func _on_TRIGGERYELLO_body_entered(body):
if body == null: return
body.play("PlayerYellow"