I am an absolute beginner to godot and programming in general. I picked up godot 4 (not the best idea since documentation for that version isn't the best right now) and decided it would be a great idea to follow a tutorial for godot 3 (if its not obvious from the code its a pong clone tutorial), again, not the best idea, and ran into the problem described in the title
extends CharacterBody2D
const SPEED = 200.0
var move_direction = Vector2(0,get_opponent_diretion())
@export_node_path(CharacterBody2D) var ball
func _physics_process(_delta):
velocity = move_direction * SPEED
move_and_slide()
func get_opponent_diretion():
if abs(ball.position.y - position.y) > 25:
if ball.position.y > position.y: return 1
else: return -1
else: return 0
I get an error at line 14, when trying to get the position of the ball from the @export_node_path(CharacterBody2D) var ball variable, can somebody explain why this is and how i can fix it?