so i have a Level Scene and i have a node for building and vehicles also a button that spawns a building and another button that spawns a vehicle.
when i click the button it .instances() the building fine and i can get the vehicle button to spawn the vehicle at the .positon of the of the building. however in the building scene i have put a position2d node at 50, 50
my proble is i cant seem to get the script in the level scene to spawn the vehicle at the position2d node .position
extends Node
const Refinary = preload("res://Assets/Refinery.tscn")
const Harvester = preload("res://Assets/Harvester.tscn")
var REFINARYSPAWN = false
var HARVESTERSPAWN = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func _process(delta: float) -> void:
if REFINARYSPAWN == true:
$HUD/RefineryButton.disabled = true
$HUD/SpawnHarvester.disabled = false
elif REFINARYSPAWN == false:
$HUD/SpawnHarvester.disabled = true
func _on_RefineryButton_pressed() -> void:
var i = Refinary.instance()
$Buildings.add_child(i)
i.position = Vector2(400,400)
REFINARYSPAWN = true
func _on_SpawnHarvester_pressed() -> void:
var i = Harvester.instance()
var b = 34
$Vehicles.add_child(i)
i.position
the building sceen is and area2d with a sprite colision shape and a position 2d node.
if anyone could help me figure this out that would be great