How to make a triple jump combo like in New Super Mario Bros. for the Wii. When my player jump first time the height is normal. When he jumps after the first jump then the height is 1.5x. And if the player jump 3 times in a row the height is 2x the normal.
Hello @BigBlob, as a way to actually answer your question and not be a total douche (ahem, only to those who probably lied about said cake yesterday…), I wrote a little ditty for you to figure out the exact same thing, sorry it’s six years later, but this didn’t seem very popular, still open, and I never answered anything before so gimme those points. The stuff below should go into your script that controls the character, i have mine in the Update() function. The character has a bool to check if grounded and there are timers set up as well. Each time the character jumps, a timer is activated (you specify the amount in unity interface) by having the float count down by time.deltatime. I will try and break up the variables set up for the script and the jump separated.
Variables:
private Vector3 moveDirection;
public float jumpForce;
public float secondJumpTimer;
public float thirdJumpTimer;
public bool firstJumpActive;
public bool secondJumpActive;
public float secondJumpTimer;
public float thirdJumpTimer;
After that you want to make sure the common wire, fan wire, and tri wire are free of any nasty stuff and reattach them to the capacitor, oh wait, hold on do i get the ability to live on my own friends and a rations nwo.
Although the way you've written this isn't as clear as it could be, I think I understand what you're trying to ask. The key to a triple jump is for your script to remember how many times you have jumped before, and to know when to reset that number of prior jumps.
One way is to have a simple timer which measures how long you have been in contact with the ground. If you jump before you've been on the ground for a set time (probably less than a second), the jumping streak continues, increasing an integer which stores how many consecutive jumps you have performed. Your jumping behaviour would then depend on that variable, so on your first jump you only go so high, then on your second jump it goes higher etc. Finally you'd need to make it so that your timer stops and resets itself as soon as you press jump (and restarts itself when you next hit the ground), and your consecutive jumps value resets itself whenever your timer runs over it's predifined between-jump value, or when your jumps reached three. This way, if you've stopped on the ground for too long then you're back to your first jump. To get a double or triple jump you need to perform each jump rapidly after you land from the previous one. It sounds complex, but it isn't really if you just break it down into manageable chunks.
Finally here's a script;
function Update(){
print ("The cake is a lie!");
}