Roughly reorganized UI into canvas layers in the game scene for Jennie.
This commit is contained in:
parent
f8fdeff2d6
commit
7939e77dff
11 changed files with 187 additions and 31 deletions
41
scenes/hud.gd
Normal file
41
scenes/hud.gd
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
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"
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey and event.pressed and event.keycode == KEY_SPACE:
|
||||
_on_close_pressed()
|
||||
|
||||
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!")
|
||||
Loading…
Add table
Add a link
Reference in a new issue