Animate doors!
This commit is contained in:
parent
e4ebd6bf83
commit
7ce2863cfd
13 changed files with 160 additions and 23 deletions
|
|
@ -1,5 +1,7 @@
|
|||
extends MarginContainer
|
||||
|
||||
var _displayed_floor := -1
|
||||
|
||||
func _ready():
|
||||
$StatsColumn/FloorLabel.text = "FLOOR: 10"
|
||||
$StatsColumn/SavedLabel.text = "SAVED: 0"
|
||||
|
|
@ -12,7 +14,23 @@ func _ready():
|
|||
EventBus.score_changed.connect(update_score)
|
||||
|
||||
func update_floor(floor_num: int):
|
||||
$StatsColumn/FloorLabel.text = "FLOOR: " + str(floor_num)
|
||||
if _displayed_floor == floor_num:
|
||||
return
|
||||
var label = $StatsColumn/FloorLabel
|
||||
var new_text = "FLOOR: " + str(floor_num)
|
||||
if _displayed_floor == -1:
|
||||
label.text = new_text
|
||||
_displayed_floor = floor_num
|
||||
return
|
||||
_displayed_floor = floor_num
|
||||
label.pivot_offset = Vector2(0, label.size.y)
|
||||
var tween = create_tween()
|
||||
tween.tween_property(label, "scale:y", 0.0, 0.15).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_IN)
|
||||
tween.tween_callback(func():
|
||||
label.text = new_text
|
||||
label.pivot_offset = Vector2.ZERO
|
||||
)
|
||||
tween.tween_property(label, "scale:y", 1.0, 0.15).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_OUT)
|
||||
|
||||
func update_saved(count: int):
|
||||
$StatsColumn/SavedLabel.text = "SAVED: " + str(count)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue