toddler-play/env/jumper.gd
2024-06-05 00:15:22 +08:00

13 lines
244 B
GDScript

extends Area2D
const SPRING_FORCE = -460
func _on_body_entered(body):
if body.name == 'Player':
$AnimationPlayer.play('push')
body.velocity.y = SPRING_FORCE
body.get_node('Sprite').play('jump')
else:
$AnimationPlayer.play('idle')