Double Jump/Rocket Boost

To start the double jumping mechanic, I first looked at my current movement code and began modifiying the Jump and MyInput functions which can be seen in the video below. 

In this video, I create some new variables such as the doubleJumped bool which tracks when the player has double jumped and when this bool is true, the player shouldn't be able to jump again while in the air. The bool is reset when the player hits the ground again. I also created the hasJumped1 bool which tracks if the player has jumped only once, that was not in the air. To create the actual double jump I made the hasJumped1 bool true after the player has jumped in the Jump function. Then I made another if statement that checked if the player is pressing space again, if so then the Jump function is called again and doubleJumped is made true, the player should now not be able to jump again.


Issues

An issue I encountered in this video was the double jump not working at all. In the video I was playtesting after I finished coding and found that the player could not double jump for some reason. After some tweaking and bug fixing, the double jump seemed to occur at the exact time as the regular jump. The problem was that the ground check game object (located at the bottom of the player) was a little too low and may have been preventing the jumping from working as the grounded bool as changing a little late. This partly would be what caused the double jump to not work at all.


Solutions

 I eventually got it to work after making a DoubleJumpForce function which was almost the same as Jump except the jump force is different. Then I called this new function instead of jump when the player wants to double jump. I called this function in a new function called DoubleJump which is constantly called in the update function. DoubleJump tracks if the player has pressed space while not grounded and has not already double jumped. This was a good solution as not only does the double jumping now work with no issues, I can change how force the double jump force is applied which is different than the regular jump. This is also good because the force in the first and second jump are different and both can be changed to preference. After doing this, the double jumping seemed to work pretty well. This video below shows me applying these fixes:



Next time, I would make sure I had allocated more time to bug fixing and tweaking as I had some issues that took some major time to resolve. I have also learnt that double jumping needs to be in a separate function and so if I program it like this the first time around, I would save time and it should work without any issues. This impacted my further production as I now had less time to bug fix and tweak my other mechanics. This means I now have to give myself a harder work schedule to catch up on time while bug fixing.