Flopsy/objects/falling_log/falling_log.gd

18 lines
425 B
GDScript

extends StaticBody2D
export var recover_time : float = 2.0
func _ready():
$Animation.play("recover")
func _on_PlayerCollision(body):
$PlayerCollision/Collision.disabled = true
$Animation.play("player_on_log")
func _on_Animation_finished(anim_name):
if anim_name == "player_on_log":
yield(get_tree().create_timer(recover_time), "timeout")
$PlayerCollision/Collision.disabled = false
$Animation.play("recover")