Change how map loading works

This commit is contained in:
gamer147
2026-04-01 17:48:47 -04:00
parent 0233cb6f46
commit 470e89b15b
6 changed files with 84 additions and 56 deletions

View File

@@ -1,38 +0,0 @@
extends Node
const GRID_SIZE := 5
@export var dl_map: CombatMap
@export var unit_template: PackedScene
@export var player_allegiance: UnitAllegiance
@export var enemy_allegiance: UnitAllegiance
func _ready() -> void:
for x in GRID_SIZE:
for y in GRID_SIZE:
var pos := Vector2i(x, y)
var is_edge := x == 0 or x == GRID_SIZE - 1 or y == 0 or y == GRID_SIZE - 1
if is_edge:
dl_map.draw_wall(pos)
else:
dl_map.draw_floor(pos)
# Create a putit at the center belonging to the player
var center := Vector2i(GRID_SIZE / 2, GRID_SIZE / 2)
var unit: Unit = unit_template.instantiate()
unit.stat_template = UnitStats.new(50)
unit.info_template = UnitInfo.new()
unit.allegiance_template = player_allegiance
unit.info_template.name = "Putit"
unit.position = dl_map.coords_to_world(center)
get_parent().add_child.call_deferred(unit)
# Create a putit at one above the center belonging to the enemy
var center_enemy := Vector2i(GRID_SIZE / 2, (GRID_SIZE / 2) - 1)
var enemy_unit: Unit = unit_template.instantiate()
enemy_unit.stat_template = UnitStats.new(50)
enemy_unit.info_template = UnitInfo.new()
enemy_unit.allegiance_template = enemy_allegiance
enemy_unit.info_template.name = "Putit"
enemy_unit.position = dl_map.coords_to_world(center_enemy)
get_parent().add_child.call_deferred(enemy_unit)

View File

@@ -1 +0,0 @@
uid://c8xb86ty7rduf