Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | SuperSopwith |
onready var raycast = get_node("RayCast2D")
func _physics_process(delta):
var playerposition = get_parent().get_node("Player").position
$RayCast2D.set_cast_to(playerposition)
var coll = raycast.get_collider()
if coll.is_in_group("player"):
print("TIS BUT A SCRATCH")
look_at(playerposition)
shoot()
The code is above. I’m getting the error “Attempt to call function ‘is _in _ group’ in base ‘null instance’ on a null instance” Does anyone know why this could be happening?