Author Topic: Infinite Jump?  (Read 2308 times)

kilgour22

  • Cherry Eater
  • Posts: 82
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Firefox 29.0 Firefox 29.0
    • View Profile
  • Playstyle: Keyboard
Infinite Jump?
« on: May 23, 2014, 04:15:37 PM »
Anyone able to help with how to code a proper infinite jump? Any help would be much appreciated!
Don't let a spike ruin your day.

lemonxreaper

  • Administrator
  • Spike Dodger
  • Posts: 222
  • Do you even needle?
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 29.0 Firefox 29.0
    • View Profile
Re: Infinite Jump?
« Reply #1 on: May 23, 2014, 07:01:11 PM »
it is quite simple to get this working.

Create an object, call it InfJump or whatever you want.
you dont need to give it a sprite or anything like that.
in the step event of this object add:

with(player){djump = true}

then just place this object in the room you want to have inf jump or have it created or destroyed by another object.

There are other ways that are perhaps more efficient but really it doesn't matter that much and such ways are more complicated.
Just pretend I have a cool picture like Zero.
Completed Fangames: https://dl.dropboxusercontent.com/u/4678222/Complete%20Fangames.txt

klazen108

  • Administrator
  • The Kid
  • Posts: 286
  • your a kid now your a squid now
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Firefox 29.0 Firefox 29.0
    • View Profile
    • Delicious-Fruit
  • Playstyle: Keyboard
Re: Infinite Jump?
« Reply #2 on: May 24, 2014, 12:16:36 PM »
That is definitely the simplest way and the added overhead of setting an additional variable every step is really negligible. I know the Nekoron Engine defaults to having a screen-sized sprite and on collision with player does with(other)djump=true; but that is even less efficient than just setting the variable every step.

I guess the most optimized way to do it would to add a global variable to the playerJump script, that allows you to double jump if djump==true OR if global.infJump==true, and just set that true/false as needed. But assuming your game isn't tottering on the edge of crashing, just setting djump=1 every step will work just fine :Kappa: