summaryrefslogtreecommitdiff
path: root/scripts/ui_panel.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ui_panel.gd')
-rw-r--r--scripts/ui_panel.gd9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/ui_panel.gd b/scripts/ui_panel.gd
index 31275c6..7d3cd7a 100644
--- a/scripts/ui_panel.gd
+++ b/scripts/ui_panel.gd
@@ -1,16 +1,15 @@
extends Panel
var tile_set : TileSet = preload("res://resources/tiles.tres")
+var game_stats_config = preload("res://resources/game_stats_config.tres")
+@onready var util = preload("res://scripts/util.gd")
-@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)
+ var texture = util.get_tile_texture(game_stats_config.defenders[object_name.to_lower()]["sprite_panel"])
+ $HBoxContainer/Texture.texture = texture
$HBoxContainer/Texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
$HBoxContainer/VBoxContainer/Label.text = object_name
$HBoxContainer/VBoxContainer/Label2.text = cost