diff options
author | bd <bdunahu@operationnull.com> | 2025-05-23 18:06:37 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-05-23 18:06:37 -0400 |
commit | 39acc5aff9c7ac75b34364ed4d389d7a6bcfc53d (patch) | |
tree | a50e78c0e5ad0899f2dd369259a806ed3a1ad4d1 /scripts/ui_panel.gd | |
parent | 6d166db85ec2518b3219240f7cbf26221eec1f76 (diff) |
Refactor tower sprites + animation scripts
Diffstat (limited to 'scripts/ui_panel.gd')
-rw-r--r-- | scripts/ui_panel.gd | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/ui_panel.gd b/scripts/ui_panel.gd new file mode 100644 index 0000000..31275c6 --- /dev/null +++ b/scripts/ui_panel.gd @@ -0,0 +1,16 @@ +extends Panel + +var tile_set : TileSet = preload("res://resources/tiles.tres") + +@export var texture_atlas_coords: Vector2 +@export var object_name: String +@export var cost: String + +func _ready(): + var source : TileSetAtlasSource = tile_set.get_source(0) + var texture_region : Rect2i = source.get_tile_texture_region(texture_atlas_coords) + var tile_image : Image = source.texture.get_image().get_region(texture_region) + $HBoxContainer/Texture.texture = ImageTexture.create_from_image(tile_image) + $HBoxContainer/Texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED + $HBoxContainer/VBoxContainer/Label.text = object_name + $HBoxContainer/VBoxContainer/Label2.text = cost |