I wanted to give the playable character an air dash. Despite still not really being able to understand how to code, I technically succeeded. However there are a few issues with it.
Issue #1: It won't boost my character if I'm not already holding left (in this case, the A key) or right (D key). It will, however, still play the boost animation. I have a feeling this issue could be solved if I new how to code in something that checks what direction the player sprite is facing, but I do not.
Issue #2: If the character is already playing their falling animation, then it will not swap to the boost animation when performing an air dash at this point.
Issue #3: They're only really supposed to air dash once per jump. However, as long they're not touching the ground, they can dash infinitely.
Here's what the code looks like right now for reference:
#Handle Boost
if Input.is_action_just_pressed("lightning_boost") and not is_on_floor():
if direction == -1:
velocity.x = -7000.0
elif direction == 1:
velocity.x = 7000.0
anim.play("boost")