fix console errors
This commit is contained in:
parent
29b571317f
commit
3ba645b724
4 changed files with 34 additions and 23 deletions
|
@ -64,14 +64,14 @@ func start():
|
|||
BackgroundMusic.crossfade_to(MUSIC, -10, 1)
|
||||
start_timer_UI.init()
|
||||
var t = Timer.new()
|
||||
t.set_wait_time(0.5)
|
||||
t.wait_time = 0.5
|
||||
t.autostart = true
|
||||
add_child(t)
|
||||
t.start()
|
||||
for n in range(3,0,-1):
|
||||
start_timer_UI.update_timer(n)
|
||||
yield(t, "timeout")
|
||||
start_timer_UI.update_timer(0)
|
||||
instructionsUI._init()
|
||||
instructionsUI.start()
|
||||
foreground.start()
|
||||
player.start()
|
||||
yield(t, "timeout")
|
||||
|
@ -90,6 +90,7 @@ func start():
|
|||
|
||||
func stop():
|
||||
foreground.stop()
|
||||
instructionsUI.stop()
|
||||
player.stop()
|
||||
spawner.stop()
|
||||
score_timer.stop()
|
||||
|
|
|
@ -1,32 +1,38 @@
|
|||
extends Control
|
||||
|
||||
onready var timer := $Timer
|
||||
|
||||
var jump_key = "dialogic_next"
|
||||
|
||||
var jumped = false
|
||||
var waiting = false
|
||||
|
||||
func _wait_for_jump():
|
||||
var t = Timer.new()
|
||||
t.set_wait_time(0.5)
|
||||
add_child(t)
|
||||
t.start()
|
||||
while(!jumped):
|
||||
yield(t, "timeout")
|
||||
if visible:
|
||||
hide()
|
||||
else:
|
||||
show()
|
||||
yield(t, "timeout")
|
||||
hide()
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed(jump_key):
|
||||
jumped = true
|
||||
if event.is_action_pressed(jump_key) and waiting:
|
||||
waiting = false
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
hide()
|
||||
|
||||
|
||||
func _init():
|
||||
func stop():
|
||||
waiting = false
|
||||
timer.stop()
|
||||
hide()
|
||||
|
||||
|
||||
func start():
|
||||
waiting = true
|
||||
timer.start()
|
||||
show()
|
||||
_wait_for_jump()
|
||||
|
||||
|
||||
func _on_Timer_timeout() -> void:
|
||||
if waiting:
|
||||
if visible:
|
||||
hide()
|
||||
else:
|
||||
show()
|
||||
else:
|
||||
stop()
|
||||
|
|
|
@ -36,3 +36,8 @@ margin_bottom = 207.0
|
|||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Appuyer sur ESPACE pour sauter"
|
||||
align = 1
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
|
|
@ -70,5 +70,4 @@ func start():
|
|||
func stop():
|
||||
timer.stop()
|
||||
for obj in items.get_children():
|
||||
remove_child(obj)
|
||||
obj.queue_free()
|
||||
|
|
Loading…
Reference in a new issue