Advertisement Jump to content
Sign in to follow this  
mayer

Super Mario type code

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!