From 36abc689d783774ce4f2d7b5a1bb621d8684be45 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sat, 4 Jun 2022 23:00:58 -0600 Subject: added more ui for after gameplay, generalized basic food --- src/tools/score_manager/scripts/score_label.gd | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/tools/score_manager/scripts/score_label.gd (limited to 'src/tools/score_manager/scripts/score_label.gd') 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() -- cgit v1.2.3