First commit 🎉
This commit is contained in:
commit
43ea213f9b
728 changed files with 37080 additions and 0 deletions
37
game/gui/components/sierra_bar/sierra_bar.gd
Normal file
37
game/gui/components/sierra_bar/sierra_bar.gd
Normal file
|
@ -0,0 +1,37 @@
|
|||
extends Control
|
||||
|
||||
@export var score := 0
|
||||
@export var max_score := 100
|
||||
|
||||
@onready var lbl_game_name: Label = %LblGameName
|
||||
@onready var lbl_score: Label = %LblScore
|
||||
|
||||
|
||||
#region Public #####################################################################################
|
||||
func set_game_name(game_name: String) -> void:
|
||||
lbl_game_name.text = game_name
|
||||
|
||||
|
||||
func reset_score() -> void:
|
||||
score = 0
|
||||
_update_text()
|
||||
|
||||
|
||||
func add_score(value: int) -> void:
|
||||
score += value
|
||||
_update_text()
|
||||
|
||||
|
||||
func subtract_score(value: int) -> void:
|
||||
score -= value
|
||||
_update_text()
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private ####################################################################################
|
||||
func _update_text() -> void:
|
||||
lbl_score.text = "%d/%d" % [score, max_score]
|
||||
|
||||
|
||||
#endregion
|
Loading…
Add table
Add a link
Reference in a new issue