diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-19 15:24:50 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-19 15:24:50 +0100 |
commit | 72863ffa31e27f4c6be862d80472cfb897fccaea (patch) | |
tree | ce04be8d77b10c797c8ff854c8ff1a219eb1af46 /UI/spawn_button.gd | |
parent | 63d2a59042fb9d90a586ad85d8364de7c38aea8e (diff) |
Diffstat (limited to 'UI/spawn_button.gd')
-rw-r--r-- | UI/spawn_button.gd | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/UI/spawn_button.gd b/UI/spawn_button.gd index 3051dfb..70ff3f5 100644 --- a/UI/spawn_button.gd +++ b/UI/spawn_button.gd @@ -5,6 +5,10 @@ extends TextureButton @export var sprite_sheet: SpriteFrames @export var cost := 5 +@export var hp := 5 +@export var speed := 100 + +@export var unit_resource: UnitResource func _ready(): @@ -14,11 +18,16 @@ func _ready(): func _on_pressed() -> void: var unit = preload("res://Units/Unit.tscn").instantiate() as Unit - if texture: - unit.get_node("Sprite2D").texture = texture - unit.get_node("Sprite2D").scale = Vector2(32,32) / texture.get_size() + #if texture: + #unit.get_node("Sprite2D").texture = texture + #unit.get_node("Sprite2D").scale = Vector2(32,32) / texture.get_size() + + #if sprite_sheet: + #unit.get_node("AnimatedSprite2D").sprite_frames = sprite_sheet - if sprite_sheet: - unit.get_node("AnimatedSprite2D").sprite_frames = sprite_sheet + unit.unit_resource = unit_resource + #unit.hp = hp + #unit.base_speed = speed + #unit.additional_data = {"cost": cost} Client.spawn_unit(unit, Client.current_stage.get_spawn(), Client.current_stage.get_overwrite_target()) |