Mario Physics Tutorial
Where can I find a tutorial on creating physics for a 2-D mario type game.
Thanks
Jonathan
Thanks
Jonathan
What kind of physics would Mario need? Surely it wouldn't be very complex.
All you need is stuff like Gravity, Wind and Movement.
xSpeed = xSpeed + xGravity + xWind + xMove;
ySpeed = ySpeed + yGravity + yWind + yMove;
But if you add stuff like ropes swings etc. etc. etc. your going to need to learn the
physics of those items.
Hope that helps.
xSpeed = xSpeed + xGravity + xWind + xMove;
ySpeed = ySpeed + yGravity + yWind + yMove;
But if you add stuff like ropes swings etc. etc. etc. your going to need to learn the
physics of those items.
Hope that helps.
Global warming is caused by hobos and mooses
Mario (NES) itself probebly had less physics than that. (what I just posted)
Global warming is caused by hobos and mooses
What you would need is basic newtonian stuff for the character (position, velocity, acceleration) which any game physics tutorial online would teach you. Google it or snoop around Gamedev.net and I'm sure you'll find something.
After that you'll need collision detection/response for the platforms. What exactly you'll need depends on your game and the nature of the platforms. Are they all level like the old NES games (Mario, Metroid, Kid Icarus), or can they be sloped? If the former, you're colliding with rectangles. If the latter, you're colliding with arbitrary polygons. Can the player jump through the bottom of some platforms? If so, then you have to account for that too.
You should also account for special platforms that have certain properties while the player stands on them, such as a moving platform, a conveyor belt, or an electric floor that damages the player.
After that it all depends on the details of your design.
After that you'll need collision detection/response for the platforms. What exactly you'll need depends on your game and the nature of the platforms. Are they all level like the old NES games (Mario, Metroid, Kid Icarus), or can they be sloped? If the former, you're colliding with rectangles. If the latter, you're colliding with arbitrary polygons. Can the player jump through the bottom of some platforms? If so, then you have to account for that too.
You should also account for special platforms that have certain properties while the player stands on them, such as a moving platform, a conveyor belt, or an electric floor that damages the player.
After that it all depends on the details of your design.
Justin Ficarrotta
http://www.justinfic.com
"It is better to be The Man than to work for The Man." - Alexander Seropian
There are some really good tutorials / source code at gotoAndPlay, look under the Articles tab.
Here is one that will help you get started: http://www.gotoandplay.it/_articles/2003...nd_run.php
One note though is that all these tutorials are for Flash games using Action Scripting. Regardless it should be easy to extract the needed math. One item that may be difficult to extrapolate though may be collision detection...
Here is one that will help you get started: http://www.gotoandplay.it/_articles/2003...nd_run.php
One note though is that all these tutorials are for Flash games using Action Scripting. Regardless it should be easy to extract the needed math. One item that may be difficult to extrapolate though may be collision detection...
I don't think you so much need acceleration as much as velocity... I mean, if you played any of the NES marios, there was no acceleration, even when you were running with the flying hat, you just had velocity 1, velocity 2, and then LIFT OFF!
skyhawk Wrote:... I mean, if you played any of the NES marios, there was no acceleration, ...
I beg your pardon? Sounds like you need to go back and play them again. There's very noticeable acceleration in every Mario game I've ever played, with the possible exception of the Super Mario Land series on the Gameboy. Mario has always taken a bit to get up to full speed, even when walking...
- Alex Diener
I think this is my favorite pet peeve about games that are just rip-offs of the 2D Super Mario series, which is they almost always **** up the physics, ruining what worked so elegantly in the original game. A lot of programmers see old retro games and say, 'God, that's so primitive, I could easily program that,' and then miss all the subtleties of the original game. These retro games, despite modern graphics and sound, have gameplay honed to a fine point.
Thanks for the help. I like the tutorials at gotoAndPlay. I was also looking for the collisions with the platforms and blocks. I'm not good with vectors so I was wondering if there was a tutorial on it.
This is your lucky day! 
Check out the following tutorial link posted by Alex "ThemsAllTook": http://www.idevgames.com/forum/showthrea...r+tutorial

Check out the following tutorial link posted by Alex "ThemsAllTook": http://www.idevgames.com/forum/showthrea...r+tutorial
phydeaux Wrote:These retro games, despite modern graphics and sound, have gameplay honed to a fine point.
I absolutely agree. Many of the old school games are far more fun to play than modern games.
Thanks flipflop. I'm confused though. I finally found a tutorial on gamasutra that makes some sense.
http://www.gamasutra.com/features/19991018/Gomez_4.htm
But I need someone to interpret the Box-Sphere collision code below.
What's b.min and b.max? Can someone write this out in simple code?
http://www.gamasutra.com/features/19991018/Gomez_4.htm
But I need someone to interpret the Box-Sphere collision code below.
Code:
#include "aabb.h"
//Check to see if the sphere overlaps the AABB
const bool AABBOverlapsSphere ( const AABB& B, const SCALAR r, VECTOR& C )
{
float s, d = 0;
//find the square of the distance
//from the sphere to the box
for( long i=0 ; i<3 ; i++ )
{
if( C[i] < B.min(i) )
{
s = C[i] - B.min(i);
d += s*s;
}
else if( C[i] > B.max(i) )
{
s = C[i] - B.max(i);
d += s*s;
}
}
return d <= r*r;
}What's b.min and b.max? Can someone write this out in simple code?
Ok I figured out what min and max is. Now I feel stupid
.
.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| A mixture of Mario & MegaMan Zero Tek | SeriouSamus05 | 1 | 2,475 |
Dec 8, 2011 04:40 PM Last Post: SeriouSamus05 |
|

