Jump to content
  • Advertisement
Sign in to follow this  

Super Mario type code

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

can anyone point me in the direction of a super mario type game code. I'm particularly interested in studying physics of his jumping from a higher block to a lower one or the ground. Thanks!

Share this post

Link to post
Share on other sites
The physics of jumping are fairly simple.
// Calculate Acceleration
Mario.vAcceleration.x = Mario.vForce.x / Mario.fMass;
Mario.vAcceleration.y = Mario.vForce.y / Mario.fMass;
Mario.vAcceleration.z = Mario.vForce.z / Mario.fMass;

// Calculate new velocity
Mario.vVel.x = Mario.vAcceleration.x * iTime;
Mario.vVel.y = Mario.vAcceleration.y * iTime;
Mario.vVel.z = Mario.vAcceleration.z * iTime;

// Update position
D3DXVECTOR3 vMove = Mario.vVel * (float)(iTime);
Mario.vPos = vMove;

Then to apply a jump increase the y-axis force, assuming he is on the ground.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!