STRINGS for easier text management

This commit is contained in:
Jennie Robinson Faber 2026-05-17 23:02:21 +01:00
parent 8e2a2d08f0
commit 352ab75841
13 changed files with 140 additions and 112 deletions

View file

@ -72,7 +72,7 @@ func _ready():
face.position = Vector2(0, 0)
face.size = Vector2(size.x, 30)
face.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
face.text = ">:)"
face.text = Strings.SCREEN_FACE_IDLE
face.pivot_offset = face.size / 2
_pulse.configure(sl, bz, _perfect_zone, size.x)
@ -125,7 +125,7 @@ func _ready():
_score_label.offset_right = -QUOTA_DOT_RIGHT_MARGIN
_score_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
_score_label.visible = false
_score_label.text = "SCORE: 0"
_score_label.text = Strings.SCREEN_SCORE_FMT % 0
add_child(_score_label)
EventBus.score_changed.connect(_on_score_changed)
@ -133,7 +133,7 @@ func _ready():
func start(floor_num: int = EventBus.STARTING_FLOOR):
active = true
$AIFace.text = ">:)"
$AIFace.text = Strings.SCREEN_FACE_IDLE
$TargetZone.visible = true
block_zone_moving = false
_pulse.start_floor(floor_num)
@ -153,7 +153,7 @@ func stop():
func launch_pulse():
if not active:
return
$AIFace.text = ">:)"
$AIFace.text = Strings.SCREEN_FACE_IDLE
_start_ready_pulse()
_pulse.launch()
@ -178,7 +178,7 @@ var _displayed_floor := -1
func _update_floor_label(floor_num: int):
if _displayed_floor == floor_num:
return
var new_text = "FL " + str(floor_num)
var new_text = Strings.SCREEN_FLOOR_FMT % floor_num
if _displayed_floor == -1:
_floor_label.text = new_text
_displayed_floor = floor_num
@ -229,7 +229,7 @@ func _update_quota_dots(count: int, threshold: int):
func _on_score_changed(new_score: int):
_score_value = new_score
_score_label.text = "SCORE: " + str(new_score)
_score_label.text = Strings.SCREEN_SCORE_FMT % new_score
func _update_perfect_zone():
var bz = $TargetZone
@ -254,7 +254,7 @@ func _on_pulse_started(duration: float):
pulse_started.emit(duration)
func _on_pulse_blocked():
$AIFace.text = ">:("
$AIFace.text = Strings.SCREEN_FACE_BLOCKED
_punch_face(1.4, 4.0)
flash(Color.GREEN)
pulse_blocked.emit()
@ -263,7 +263,7 @@ func _on_pulse_blocked_perfect():
pulse_blocked_perfect.emit()
func _on_pulse_escaped():
$AIFace.text = ":D"
$AIFace.text = Strings.SCREEN_FACE_ESCAPED
_punch_face(1.5, 0.0)
flash(Color.RED)
active = false
@ -282,12 +282,12 @@ func flash(color: Color):
func show_countdown():
$AIFace.visible = true
stop()
$AIFace.text = "3"
$AIFace.text = Strings.SCREEN_COUNTDOWN_3
var tween = create_tween()
tween.tween_interval(0.6)
tween.tween_callback(func(): $AIFace.text = "2")
tween.tween_callback(func(): $AIFace.text = Strings.SCREEN_COUNTDOWN_2)
tween.tween_interval(0.6)
tween.tween_callback(func(): $AIFace.text = "1")
tween.tween_callback(func(): $AIFace.text = Strings.SCREEN_COUNTDOWN_1)
tween.tween_interval(0.6)
tween.tween_callback(func(): $AIFace.text = "")
@ -295,7 +295,7 @@ func show_win():
$AIFace.visible = true
stop()
$TargetZone.visible = false
$AIFace.text = "ESCAPED"
$AIFace.text = Strings.SCREEN_WIN_TEXT
flash(Color.GREEN)
func show_loss(message: String):