Wicked-Depths/falling platform.gd

23 lines
545 B
GDScript

extends CharacterBody2D
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func _on_area_2d_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
if body.name == "plr" and $Sprite2D.visible and body.can_move:
$AnimationPlayer.play("shake")
await $AnimationPlayer.animation_finished
$Sprite2D.visible = false
$CollisionShape2D.disabled = true
$CPUParticles2D.emitting = true
$cooldown.start()
func _on_cooldown_timeout():
$Sprite2D.visible = true
$CollisionShape2D.disabled = false