diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2022-06-04 23:00:58 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2022-06-04 23:00:58 -0600 |
commit | 36abc689d783774ce4f2d7b5a1bb621d8684be45 (patch) | |
tree | a3dbed6069fbd8d9a588c7510ce581af3e847af0 /src/tools/score_manager/scripts/score_label.gd | |
parent | 9a2bcf02c2623c8f3e8f5e74e70b3c0333790484 (diff) |
added more ui for after gameplay, generalized basic food
Diffstat (limited to 'src/tools/score_manager/scripts/score_label.gd')
-rw-r--r-- | src/tools/score_manager/scripts/score_label.gd | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/tools/score_manager/scripts/score_label.gd b/src/tools/score_manager/scripts/score_label.gd new file mode 100644 index 0000000..f1ccb9d --- /dev/null +++ b/src/tools/score_manager/scripts/score_label.gd @@ -0,0 +1,42 @@ +class_name ScoreLabel +extends MarginContainer + +onready var label: Label = $Hbox/Label +onready var timer: Timer = $Hbox/Label/Timer +onready var texture_rect: TextureRect = $Hbox/Center/VBox/TextureRect + +enum Type { + BODY_SEGMENT +} + +var texture: Dictionary = { + Type.BODY_SEGMENT: preload("res://ui/hud/progress_bars/sprites/grow_progress_icon.png") +} + +var alive_time: float = 2.0 +var fmt: String = "x%s" +var points: int + + +func _ready(): + timer.connect("timeout", self, "_on_timer_timout") + timer.wait_time = 2.0 + timer.start() + + +func set_properties(_points: int, color: Color, location: Vector2, type: int=-1) -> void: + print("Constructing") + points = _points + label.text = fmt % points + label.add_color_override("font_color", color) + set_global_position(location) + if type != -1: + texture_rect.visible = true + match type: + Type.BODY_SEGMENT: + texture_rect.texture = texture[type] + label.update() + + +func _on_timer_timout() -> void: + queue_free() |