IdeaMonk

thoughts, ideas, code and other things...

Friday, March 20, 2009

Gravity in 2d Games

mariojump


I always wished to know how exactly do creators Mario, Contra and Kirby (Specially this one) program gravity. Having done with the s = ut + 0.5 * at^2 and such forumulae, I haven't yet made a perfect framework for simple gravity physics, bounces and collision reactions. But, here is an article from The Science Creative Quarterly - link that really satisfies me with a historic look and clever analysis of the gravity in Mario.

Some more places to checkout for game physics-

http://wiki.slembcke.net/main/published/Chipmunk
http://www.box2d.org/
http://www.harveycartel.org/metanet/tutorials.html
http://www.codeplex.com/FarseerPhysics -- good for .NET developers

.

Labels: ,

4 Comments:

At July 29, 2010 at 8:36 AM , Anonymous Anonymous said...

You gotta be kidding me!
It's one of the easyest things to do.

For example:

VY = VY + 1
PLAYER_Y = PLAYER_Y + VY

And when the player hits the ground we simply set VY back to 0.

I hope i could help even if this is old.

 
At July 29, 2010 at 6:55 PM , Blogger Abhishek Mishra said...

I really dont do linear falls as well :)

PLAYER_Y = PLAYER_Y + VY
^^ Do you notice a complexity coming up there? when VY becomes too large, and actor goes way too below ground level, one way is to check for its next position, and make it stick to ground if it tries to go even below it in next move.

But anyways, using 2d physics engines makes more sense these days - they are extrememly impressibe!

 
At August 10, 2010 at 9:26 AM , Anonymous Anonymous said...

Yes. But you simply put him back to ground level before drawing him ;D
They did it that way in super mario. Thats for sure.
Btw, physics engines need to be coded too^^

 
At August 10, 2010 at 3:12 PM , Blogger Abhishek Mishra said...

KTHX

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home