summaryrefslogtreecommitdiff
path: root/UI/spawn_button.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-26 17:13:40 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-26 17:13:40 +0100
commitcb9bb9d1c757b53707c741a3c8c218b513ffb5ec (patch)
tree1e3741a70672504d71685db98b22f7fe61e0e6cb /UI/spawn_button.gd
parent72863ffa31e27f4c6be862d80472cfb897fccaea (diff)
next commit
Diffstat (limited to 'UI/spawn_button.gd')
-rw-r--r--UI/spawn_button.gd19
1 files changed, 1 insertions, 18 deletions
diff --git a/UI/spawn_button.gd b/UI/spawn_button.gd
index 70ff3f5..bcf9da0 100644
--- a/UI/spawn_button.gd
+++ b/UI/spawn_button.gd
@@ -1,33 +1,16 @@
extends TextureButton
-@export var texture: Texture2D
-@export var sprite_sheet: SpriteFrames
-
-@export var cost := 5
-@export var hp := 5
-@export var speed := 100
-
@export var unit_resource: UnitResource
func _ready():
- tooltip_text = "Cost: " + str(cost)
+ tooltip_text = "Cost: " + str(unit_resource.cost) + "\n" + "Income: " + str(unit_resource.income)
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 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())