Godot Version
4.3 Stable
So, I’m trying to create a jumppad in my game (it already works) and now I want to animate it. I am using the following script for everything, but once the player steps on the jumppad it just loops the animation?
extends StaticBody2D
@export var jump_force: float = 400.0
@onready var anim: AnimatedSprite2D = $AnimatedSprite2D
func _ready() -> void:
pass
func _process(delta: float) -> void:
pass
func _on_area_2d_body_entered(body: Node2D) -> void:
if body.name == "Player":
body.velocity.y = -jump_force
if body.velocity.y < -0.001:
anim.play("ForceUp")
else: if body.velocity.y == 0:
anim.play("ForceDown")