Hey,
The solution to change the max speed and use a boolean to know if dashing or not seemed to be the good way to go.
Here are the parameters that are to be tested :
- dashing speed : how fast the NPC goes when dashing
- dashing duration : not really its duration, but the coefficient to apply to "deceleration" during dashing, as default settings would create a very short dash.
- running speed : the base speed to go back to once dashing is complete.
Now let's think about the events. If an input is detected, if it's "space bar" (example), then player dashes if he wasn't already. If it's anything else, he jumps.
How to know when the dashing is finished ? I used the fact that the player speed was at that point below the running maximal speed (and had landed), so the transition should be smouth.
Here is how it goes in a capx.