toddler-play/env/jumper.gd

13 lines
244 B
GDScript3
Raw Normal View History

2024-05-17 04:48:20 +00:00
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')