0 votes

extends Area2D
var speed = 3
var move = Vector2(0,0)
var look_vec = Vector2(0,0)
var player = null

func ready():
look
vec = player.position - global_position

func physicsprocess(delta):
move = Vector2(0,0)

move = move.move_toward(look_vec, delta)
move = move.normalized() * speed
position += move
Godot version Godot 3.0
in Engine by (12 points)

1 Answer

+1 vote

You have player = null on line 5, so player.position fails with the error message in the title.

by (21,973 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.