Jump to content
  • Advertisement
Sign in to follow this  
mayer

Super Mario type code

This topic is 4741 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
Advertisement
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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!