Flopsy/objects/falling_log/falling_log.gd

20 lines
475 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":
collision_layer = 0b0
yield(get_tree().create_timer(recover_time), "timeout")
$PlayerCollision/Collision.disabled = false
$Animation.play("recover")
collision_layer = 0b100