Scoring, floor timer, and hud updates
- Move elevator panel logic out of HUD; HUD now listens for signals to update floor, saved, people, and score labels - Add scaling rescue threshold that grows as you descend, with bonus points for exceeding it - Add per-floor timer that triggers a losing when expired - Add show_loss state on the screen for too-few-people and timeout failures
This commit is contained in:
parent
7939e77dff
commit
feb467c832
6 changed files with 97 additions and 48 deletions
|
|
@ -1,41 +1,19 @@
|
|||
extends MarginContainer
|
||||
|
||||
# I HAVE NO IDEA WHAT I'M DOIN!!!
|
||||
var current_floor := 10
|
||||
var saved_count := 0
|
||||
|
||||
var doors_closing := false
|
||||
|
||||
|
||||
func _ready():
|
||||
#$ElevatorPanel/PanelMargin/PanelColumn/CloseButton.pressed.connect(_on_close_pressed)
|
||||
# 10 floors is probably a lot but will make testing easier.
|
||||
$StatsColumn/FloorLabel.text = "FLOOR: 10"
|
||||
$StatsColumn/SavedLabel.text = "SAVED: 0"
|
||||
$StatsColumn/PeopleLabel.text = "PEOPLE: 0/2"
|
||||
$StatsColumn/ScoreLabel.text = "SCORE: 0"
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey and event.pressed and event.keycode == KEY_SPACE:
|
||||
_on_close_pressed()
|
||||
func update_floor(floor_num: int):
|
||||
$StatsColumn/FloorLabel.text = "FLOOR: " + str(floor_num)
|
||||
|
||||
func _on_close_pressed():
|
||||
# don't let 'em spam the button
|
||||
if doors_closing:
|
||||
return
|
||||
var screen = $ElevatorPanel/PanelMargin/PanelColumn/Screen
|
||||
var success = screen.attempt_hack()
|
||||
if success:
|
||||
doors_closing = true
|
||||
saved_count += 1
|
||||
current_floor -= 1
|
||||
$StatsMargin/StatsColumn/SavedLabel.text = "SAVED: " + str(saved_count)
|
||||
$StatsMargin/StatsColumn/FloorLabel.text = "FLOOR: " + str(current_floor)
|
||||
if current_floor <= 1:
|
||||
screen.show_win()
|
||||
else:
|
||||
screen.show_countdown()
|
||||
var tween = create_tween()
|
||||
tween.tween_callback(func():
|
||||
screen.reset_hack()
|
||||
doors_closing = false
|
||||
).set_delay(2.0)
|
||||
else:
|
||||
print("MISSED! AI is faster now!")
|
||||
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)
|
||||
|
||||
func update_score(new_score: int):
|
||||
$StatsColumn/ScoreLabel.text = "SCORE: " + str(new_score)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue