it says position not declared in scope
ok i see why that didn’t work but now it just stays in one place on the screen
extends Area2D
const SPEED: float = 20
const SCREEN_WIDTH_MAX = 1000
const SCREEN_WIDTH_MIN = 0
var npc_move = true
func _on_area_entered(area):
if area.is_in_group("npc"):
queue_free()
var moving_right: bool = true
func _process(delta: float) -> void:
if moving_right:
position.x += SPEED * delta
if position.x > SCREEN_WIDTH_MAX:
moving_right = false
else:
position.x -= SPEED * delta
if position.x < SCREEN_WIDTH_MIN:
moving_right = true
SPEED is pixels per second, 20 might be too low to notice.
it just blurs slightly and stays in one place
by that i mean i increased the speed to 500
Wild, can you share your SceneTree?
i just figured out the main problem thank you everyone for your help i was rereading a book i bought to teach myself godot 3 and found something that made everything click when you change the original stuff in the scene it mess up every instance but when you edit the instance it doesn’t change the original stuff i hope this makes sense to those reading this so everyone who did what i did can figure it out like i did oh and i highly reccomend the book series sams teach yourself godot in 24 hours it will be very informative to lots of things even if its for godot 3 and not 4 it can still be usefull