Godot Version
4.2.2
Question
How can I lock the position of an AnimatedSprite2D
when it starts playing?
I’m trying to create a double jump effect that plays when the second jump is performed.
The idea is to lock the position of the effect animation where it started playing and not follow the character.
# Jump logic
if jump and can_jump:
if is_on_floor():
# If on the floor, allow the first jump
velocity.y = jump_speed
jump_count = 1 # Set jump count to 1 after the first jump
can_jump = false
elif jump_count < max_jumps:
# If not on the floor, but the player still has jumps left, allow a double jump
velocity.y = jump_speed
jump_count += 2 # Increment the jump count for double jump
can_jump = false
$doubleJump.play("doubleJump")
if $doubleJump.is_playing():
pass
$AudioStreamPlayer2D.play()
I was trying to use is_playing()
but couldn’t figure it out, and didn’t find any signal that could help with this issue. I hope it makes sense, thanks.