Author Topic: How to make a triple jump?  (Read 1358 times)

Junior Nintendista

  • Guest
How to make a triple jump?
« on: October 05, 2015, 05:18:13 PM »
I saw this mechanics in I Wanna Jump The Rainbow and found it interesting.Anyone knows how to do this kind of leap, I would be grateful.

klazen108

  • Administrator
  • The Kid
  • Posts: 286
  • your a kid now your a squid now
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Chrome 45.0.2454.101 Chrome 45.0.2454.101
    • View Profile
    • Delicious-Fruit
  • Playstyle: Keyboard
Re: How to make a triple jump?
« Reply #1 on: October 05, 2015, 11:47:12 PM »
Most (all?) engines use a value called 'djump' to determine if your player can jump again. However, they just check for "true" or "false" - if true, you can, if false, you can't. Adding triple jump is fairly straightforward; instead of using it as a true/false check, use it as a counter - check if djump is greater than 0 to double jump, and remove one for each time you jump.

Take a look a this example: https://klazen.com/gm/8g (pay attention to the green comments - they explain what's changing between the two sections). On player collision with block, we set djump to 2. then, in the playerJump script, check if djump is greater than 0, and if so, subtract 1 and jump.

I tested this in the YoYoYo Engine for GMStudio, but the concept applies to all engines I can think of. Just edit those mentions of djump and you should be good to go! You can ignore the three sections at the bottom of the script snippet if you're not using the YoYoYo Engine, they're only there for completeness and shouldn't be necessary if you're using Yuuutu or a similar engine. Do check the player's create event though - you may need to set djump=2 there as well.