added respawn timer for falling blocks
This commit is contained in:
parent
25fcdd6f54
commit
86ee9b12fa
7 changed files with 51 additions and 37 deletions
|
@ -3,7 +3,8 @@ extends KinematicBody2D
|
|||
var fall = false
|
||||
export var fall_speed = 0.5
|
||||
onready var startpos = position
|
||||
onready var timer = $Timer
|
||||
onready var fall_timer = $FallTimer
|
||||
onready var refresh_timer = $RefreshTimer
|
||||
|
||||
func _physics_process(delta):
|
||||
if fall:
|
||||
|
@ -11,18 +12,21 @@ func _physics_process(delta):
|
|||
|
||||
func _on_Area2D_area_entered(area):
|
||||
if area.is_in_group("player"):
|
||||
timer.start()
|
||||
fall_timer.start()
|
||||
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_exited():
|
||||
position = startpos
|
||||
fall = false
|
||||
|
||||
func _on_RefreshTimer_timeout():
|
||||
position = startpos
|
||||
fall = false
|
||||
|
||||
func _on_Timer_timeout():
|
||||
func _on_FallTimer_timeout():
|
||||
fall = true
|
||||
refresh_timer.start()
|
||||
|
||||
|
||||
func _on_Area2D_area_exited(area):
|
||||
timer.stop()
|
||||
|
||||
fall_timer.stop()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue