lose screen gui working well

This commit is contained in:
Clevertop 2024-08-11 10:53:26 +10:00
parent d2dfb65d59
commit bfaef2f33f
3 changed files with 68 additions and 8 deletions

View file

@ -12,7 +12,7 @@ var tick_timer : float = 0
var room_started : bool = false
var current_tick = 0
var failed : bool = false
var fail_timer : float = 3
var fail_timer : float = 2
@export_group("Resources")
@export var pedestal_off_mat : Material
@ -43,17 +43,20 @@ func _process(delta):
start_room()
if Input.is_action_just_pressed("reset"):
gui.show_lose_screen("Reset Pressed", 3)
fail_room()
if room_started and current_tick < level_time+1:
tick_timer += delta
if tick_timer > level_tick: #advance tick
if current_tick == 11:
#fail_room()
pass
tick_timer = 0
current_tick += 1
if current_tick == 11:
gui.show_lose_screen("Time Expired", 3)
fail_room()
pass
print("Tick: " + str(current_tick))
for i in pedestals.size():
if i+1 == current_tick:
@ -71,10 +74,11 @@ func _process(delta):
chime_player.play()
if failed:
gui.show_lose_screen("", fail_timer)
world_env.environment.background_color = Color.DIM_GRAY
fail_timer -= delta
if fail_timer < 0:
fail_timer = 3
fail_timer = 2
reset_room()
else:
world_env.environment.background_color = Color.WHITE
@ -128,6 +132,7 @@ func reset_room():
player.rotation_degrees = Vector3(0,0,0)
player.camera.rotation_degrees = Vector3(0,0,0)
gui.hide_lose_screen()
tick_timer = 0
room_started = false