Add quota dots to screen and color-code people count

- And try to remove survivors after doors close with queue_free
- And move panel?? Still not right.
This commit is contained in:
Jennie Robinson Faber 2026-05-11 17:23:46 +01:00
parent 0cc7611515
commit b92388cfe0
7 changed files with 43 additions and 5 deletions

View file

@ -12,6 +12,8 @@ var _batch_generation: int = 0
func _enter_tree() -> void:
EventBus.floor_started.connect(_on_floor_started, CONNECT_DEFERRED)
EventBus.doors_closed.connect(_on_doors_closed)
EventBus.doors_fully_closed.connect(_clear_active_walkers)
func _on_floor_started(count: int) -> void:
_batch_generation += 1
@ -20,6 +22,9 @@ func _on_floor_started(count: int) -> void:
return
_run_batch(count, _batch_generation)
func _on_doors_closed(_fast: bool) -> void:
_batch_generation += 1
func _clear_active_walkers() -> void:
for w in _active_walkers:
if is_instance_valid(w):

View file

@ -24,6 +24,7 @@ func _on_doors_opened():
func _on_doors_closed(fast: bool):
_set_door_collision(true)
_tween_doors(DOOR_CLOSED_X, DOOR_FAST_CLOSE_TIME if fast else DOOR_DEFAULT_TIME)
_tween.chain().tween_callback(func(): EventBus.doors_fully_closed.emit())
func _on_pulse_started(duration: float):
_set_door_collision(true)

View file

@ -16,10 +16,10 @@ anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -200.0
offset_top = -140.0
offset_left = -230.0
offset_top = -160.0
offset_right = -10.0
offset_bottom = 140.0
offset_bottom = 160.0
grow_horizontal = 0
grow_vertical = 2
script = ExtResource("1_1gr6t")

View file

@ -29,7 +29,10 @@ func update_saved(count: int):
$StatsColumn/SavedLabel.text = "SAVED: " + str(count)
func update_people(count: int, threshold: int):
$StatsColumn/PeopleLabel.text = "PEOPLE: " + str(count) + "/" + str(threshold)
var label = $StatsColumn/PeopleLabel
label.text = "PEOPLE: " + str(count) + "/" + str(threshold)
var color = Color(0.4, 1.0, 0.4) if count >= threshold else Color(1.0, 0.4, 0.4)
label.add_theme_color_override("font_color", color)
func update_score(new_score: int):
$StatsColumn/ScoreLabel.text = "SCORE: " + str(new_score)

View file

@ -29,6 +29,11 @@ const GLOW_PADDING := Vector2(6, 6)
const GLOW_COLOR := Color(1, 0.3, 0.3, 0.35)
const PERFECT_ZONE_RATIO := 0.3
const PERFECT_ZONE_COLOR := Color(1.0, 0.95, 0.4, 0.85)
const QUOTA_DOT_SIZE := 12.0
const QUOTA_DOT_SPACING := 8.0
const QUOTA_DOT_Y_FROM_BOTTOM := 14.0
const QUOTA_EMPTY_COLOR := Color(0.6, 0.1, 0.1, 0.95)
const QUOTA_FILLED_COLOR := Color(0.2, 1.0, 0.2, 1.0)
var base_color: Color
@ -42,6 +47,8 @@ var _face_scale_tween: Tween
var _face_shake_tween: Tween
var _flash_tween: Tween
var _floor_label: Label
var _quota_dots: Array[ColorRect] = []
var _quota_threshold := 0
signal pulse_started(duration: float)
signal pulse_blocked
@ -99,6 +106,7 @@ func _ready():
_floor_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_floor_label)
EventBus.floor_changed.connect(_update_floor_label)
EventBus.people_changed.connect(_update_quota_dots)
func start(floor_num: int = EventBus.STARTING_FLOOR):
active = true
@ -151,6 +159,26 @@ func _update_floor_label(floor_num: int):
_displayed_floor = floor_num
UIUtils.flip_label_text(_floor_label, new_text)
func _update_quota_dots(count: int, threshold: int):
if threshold != _quota_threshold:
_quota_threshold = threshold
for dot in _quota_dots:
dot.queue_free()
_quota_dots.clear()
var total_w = threshold * QUOTA_DOT_SIZE + max(0, threshold - 1) * QUOTA_DOT_SPACING
var start_x = (size.x - total_w) / 2.0
var y = size.y - QUOTA_DOT_Y_FROM_BOTTOM
for i in threshold:
var dot = ColorRect.new()
dot.size = Vector2(QUOTA_DOT_SIZE, QUOTA_DOT_SIZE)
dot.position = Vector2(start_x + i * (QUOTA_DOT_SIZE + QUOTA_DOT_SPACING), y)
dot.color = QUOTA_EMPTY_COLOR
dot.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(dot)
_quota_dots.append(dot)
for i in _quota_dots.size():
_quota_dots[i].color = QUOTA_FILLED_COLOR if i < count else QUOTA_EMPTY_COLOR
func _update_perfect_zone():
var bz = $TargetZone
var width = bz.size.x * PERFECT_ZONE_RATIO

View file

@ -11,7 +11,7 @@ var speed: int = 3
var clumsiness: int = 0
var _saved: bool = false
@onready var safety_zone = get_node("/root/Game/World/ElevatorSafeZone")
@onready var safety_zone: Node = get_node_or_null("/root/Game/World/ElevatorSafeZone")
#func start(xform):

View file

@ -14,6 +14,7 @@ signal game_lost(reason: String)
signal floor_started(survivor_count: int)
signal doors_opened
signal doors_closed(fast: bool)
signal doors_fully_closed
signal pulse_started(duration: float)
signal pulse_blocked
signal robot_stun_requested(duration: float)