I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: kilgour22 on May 23, 2014, 04:15:37 PM

Title: Infinite Jump?
Post by: kilgour22 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!
Title: Re: Infinite Jump?
Post by: lemonxreaper 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.
Title: Re: Infinite Jump?
Post by: klazen108 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: