new version of main spawning a unit

This commit is contained in:
gdz
2025-12-14 00:00:35 +01:00
parent d1758f750d
commit 21bd9b1bb1

View File

@@ -1,18 +1,24 @@
extends Node
@onready var _Map: Node = $Map
#@onready var _Player = $Player
#@onready var _Camera = $WorldCamera
@onready var _Unit = $Unit
@onready var _Camera = $CameraController
@export var mapSize: int = 15
var _UnitScene = preload("res://Scenes/Unit/unit.tscn")
#@export var mapSize: int = 15
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var thread: Thread = Thread.new()
thread.start(func(): _Map.generate_map(mapSize))
thread.wait_to_finish()
_createUnit(Vector2i(150, 150))
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _createUnit(pos: Vector2i):
var newUnit = _UnitScene.instantiate()
newUnit.global_position = pos
add_child(newUnit)