29 lines
498 B
GDScript
29 lines
498 B
GDScript
extends KinematicBody2D
|
|
|
|
var fall = false
|
|
export var fall_speed = 0.5
|
|
onready var startpos = position
|
|
onready var timer = $Timer
|
|
|
|
func _physics_process(delta):
|
|
if fall:
|
|
position.y += fall_speed
|
|
Debug.print($Timer.get_time_left())
|
|
|
|
func _on_Area2D_area_entered(area):
|
|
if area.is_in_group("player"):
|
|
$Timer.start()
|
|
|
|
|
|
func _on_VisibilityNotifier2D_screen_exited():
|
|
position = startpos
|
|
fall = false
|
|
|
|
|
|
func _on_Timer_timeout():
|
|
fall = true
|
|
|
|
|
|
func _on_Area2D_area_exited(area):
|
|
$Timer.stop()
|
|
|