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 extends Node
@onready var _Map: Node = $Map @onready var _Map: Node = $Map
#@onready var _Player = $Player @onready var _Unit = $Unit
#@onready var _Camera = $WorldCamera @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. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
var thread: Thread = Thread.new() _createUnit(Vector2i(150, 150))
thread.start(func(): _Map.generate_map(mapSize)) pass
thread.wait_to_finish()
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(delta: float) -> void:
pass pass
func _createUnit(pos: Vector2i):
var newUnit = _UnitScene.instantiate()
newUnit.global_position = pos
add_child(newUnit)