You need to create a custom state for your character. You can mostly follow the documentation on the wiki here:
https://wiki.srb2.org/wiki/State. It is a little out of date though, so I recommend also opening up another mod with custom states, such as this one
https://mb.srb2.org/showthread.php?t=48758 and examine its lua files to help you with the discrepancies between SRB2 2.1 and SRB2 2.2.
---------- Post added at 01:32 AM ---------- Previous post was at 01:18 AM ----------
Once you have a custom state to hold your sprites, you need to call an addHook function for the AbilitySpecial hook as described here:
https://wiki.srb2.org/wiki/Lua/Hooks#AbilitySpecial.
The function that you write for it needs to contain the following:
- It should start by checking if the player performing the ability is currently playing as your custom character. If that player is not, the function should end, returning false or nil. This way only your character will have this ability.
- If your character should be able to double jump right then, then it needs it's mobj's state set to your custom state. This will cause it to begin its animation.
- Once your custom character is in your custom state, give the character the proper thrust for its ability. this can be done using the A_ZThrust action, or by directly modifying the character's mobj's momz.
--Here's the documentation for A_ZThrust:
https://wiki.srb2.org/wiki/A_ZThrust.
--Modifying the momz directly would look something like this: player.mobj.momz = yourThrustAmount * P_MobjFlip(player.mobj)
--It should also take into account the difference between normal, space, and water gravity as well eventually. For now though just focus on getting it to work with normal gravity.
- Lastly, after thrusting your custom character into the air, the function in the AbilitySpecial hook needs to return true. This will override the default ability so that it doesn't interfere with yours.