Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2D Platformer Physics...

Author
Message
Dreadlox
20
Years of Service
User Offline
Joined: 31st May 2003
Location:
Posted: 6th Jul 2003 19:53
I am in need of help with my 2D Platformer. At the moment I am having trouble making the character accelerate and decelerate, like for instance when the character jumps and moves to the left at the same time, when the jump button is released the character should keep moving with the force of the movement to the left, but it stops stock still.
Also, I need to create a condition that when the character jumps onto an opponent it can kill it but otherwise it will get injured by it.
CrayZemon
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: United States
Posted: 7th Jul 2003 05:48
Ah physics, so much above me yet so admired. I all else fails use a force vector system. I developed this for an engine of mine that is a simple 2D space shooter.
you'll program two variables:
force_x=0
force_y=0
Then every time an operation with the keyboard, joystick is introduced, accelerate the force variables to a maximum level. Then add the variables to the player x/y position. To introduce friction, you just subtrack a value of friction that is smaller than the increments used to beef up the forces once the keys are not pressed.
If you want I could send you a code snippet. I simply fear that posting it now could take way too much space before my welcome.

"I need gopher-chucks!!"

Login to post a reply

Server time is: 2024-04-25 11:29:43
Your offset time is: 2024-04-25 11:29:43