Hi there.
Thanks to your help, i'm making a great progress in my game. But now I'm facing a new problem.
The Jumps.
I've made my player character able to jump verticaly, the character doesn't really jump, it's only an animation. But now I have to make him able to jump forward pressing some key, and I'm completely clueless
On the other hand, I'd like my player character to be able to reach ledges, as the player character of 1213.
Can anyone help me?
That's actually very heavy scripting wise (I mean it's really hard to implement). For normal jumps you can have a simple animation playing most of the time, but if you want real jumps, you will need to add gravity. Move your player down every frame if he doesn't stand on a platform (do collision checks to find out if he does or not) and if you want him to jump, just give him an upward force.
If you don't have a clue what I was just rying to say, then you should probably look into something easier first.
Yes, I noticed about the gravity before and made a function for that:
function gravity()
{
player.StopMoving();
player.SetWalkSpeed(1,6);
player.y++;
}
Then I uses a region that cover the whole room, except the walkable areas that serve as floor for the player character.
Then I wrote "gravity ()" at the "While player stands on region" script. This way, when the player character walks over a walkable area that is overlapping with the "gravity region" the character falls.
So, the gravity problem is solved by now.
So couldn't you just add a force to your player character that will move him upwards (y--) and gets less and less and then release the character to the gravity to pull him downwards? Those things always take quite an amount of fiddling around...
Since there's no real need to make the character jump but to make that looks like he jumps, I have no problem with the vertical jump. My real problem comes when the character has to reach a ledge and stay suspended.
Then you could go fake all the way and just check if the player is standing underneath a ledge (with regions etc.) and - if he does - you play an animation of the player jumping up and grabbing the ledge. If the player then presses up, you show an animation of him moving up onto the new platform.
That could work, I'll try it.
Thank you