Sign in to follow this  
mayer

Super Mario type code

Recommended Posts

mayer    122
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this