Page 1 of 1

I had a big brain mix up.

PostPosted: Sat Mar 17, 2007 6:22 pm
by Hblade
Lol, I havn't made a pla form game in so long. platform game in so long, that forgot how to make a good jump. Lol. I forgot how to repeat false the jump, meaning, you can opnly jump one time. I can't believe I forgot how to do that. Can someone please tell me how I can make a 1 jump thing? Lol.

PostPosted: Sat Mar 17, 2007 10:27 pm
by DilloDude
I've discovered a new method which works really well, allthough not so well on slopes (probably). I'll tell you soon, because I have to go now.

PostPosted: Sun Mar 18, 2007 12:53 am
by DilloDude
Here is what you do: first, you make a set of ground tiles. Make them whatever size you want. Then, mak another sort of tile: these should have the same width as the ground tiles, but be only one pixel high. Tile out the ground tiles in your level. Then, tile the othr tiles (call it topSense or something like that) so it's sitting just on top of the ground tile. It should be occupying th pixels just above the ground tiles, not the top row of the tiles. Your player has a collision event with the top side of the ground tiles (or any actor and check variables) which sets a jump variable to onGround (whatever value you want) and does the physical response. Add a collision finish event with the topSense tiles which sets the jump variable to inAir. In the player's draw actor, put a code the checks if you are in the air and yvelocity is less than a certain value, and increases the yvelocity:
Code: Select all
if (jumpState == inAir && yvelocity < 30)
{
    yvelocity += .5;
}
The good thing about this is that it only makes you fall when you are not on the platform, so ou aren't repeatedly calculating the collision. When you want to jump, check if the jumpState variable is onGround, and if it is, activate the jump code.
Hope this helps. If you have problems, just ask.