Godot Version
4.7.2
Question
I’ve been trying to create a simple script that generates a straight road that is split into sections, however I can’t figure out how to fix an issue I’m having.
var straightRoad = preload("res://Scenes/road.tscn")
func _ready() -> void:
for road in range(100):
var instance = straightRoad.instantiate()
instance.position.y = position.y + road * 10 // ERROR HERE
The debugger is telling me that the instance I made does not have a position value, however the straightRoad resource is a Sprite2D, which should have a position value. The instance variable should be a Node2D, right?