views:

3177

answers:

10
+7  A: 

Some of the tutorials here will probably help you:

http://www.gamedev.net/reference/

grepsedawk
+1  A: 

That may be a detour, but try the Platformer starter kit from XNA 3.0, that contains stuff like Physics and basic Collision detection. You will need to change stuff to make it work outside of XNA, but it's not rocket science.

XNAGS 3.0 download

Michael Stum
+5  A: 

Download the FarseerPhysics engine, have a look at how it works http://www.codeplex.com/FarseerPhysics I think it's the best thing available for XNA/Silverlight!

Shahin
+2  A: 

Gravity is easy:

const gravity = ... ; // pixels per timestep (eg. video frame) squared
// while in freefall, each timestep:
y_velocity += gravity;
y_pos += y_velocity;

Mind you, most 2d platform games I've played don't have realistic gravity. Just do whatever makes the game fun!

Hugh Allen
Technically, I think you should update position first (so it uses the velocity of the previous timestep), then update velocity.
gnovice
A: 

Ever heard of GameMaker?

GameFreak
That takes all the fun out of it.
FlySwat
+2  A: 

jnrdev might be of some assistance. It covers tile collision/response and slopes. It's not the best code I have ever seen, but it gets the job done.

Zack Mulgrew
Thanks for that link. I was going to recommend it as well but it has since been lost over the years in my bookmarks :)
grepsedawk
A: 

yawnz dear god.... write code not drag and drop... Amen! :P

A: 

I don't know what you're using for a physics model, but physics models that use fluid drag were recently addressed in another SO question. I won't repeat everything that I gave in my answer, I'll just link to it.

To summarize, the OP for the question wanted to accelerate an object from rest to a maximum velocity. I went through a few derivations for modeling velocity as a function of time for two different types of drag. Your situation may be slightly different, so the integrals used may have different forms or need to be solved with different initial conditions, but hopefully my answer will point you in some informative directions.

gnovice
+1  A: 

There are a couple of really useful 2-d platformer tutorials at http://www.metanetsoftware.com/technique/tutorialA.html and http://www.metanetsoftware.com/technique/tutorialB.html. I think they've been referenced by others elsewhere on SO. They cover collision detection and response, raycasting, various optimisation techniques etc. and have a good explanation of the theory behind it all for those (like me) who are less mathematically inclined. It doesn't go as far as stuff like rigid body dynamics, but I don't think you'd need that for the type of game you are writing (though it would of course be cool if you added this sort of stuff...)

bm212
by the look of it, the tutorials I suggested cover similar stuff to jnrdev mentioned by Zack Mulgrew. I haven't read jnrdev yet (beyond an initial glance) so can't really compare them though.
bm212
A: 

Your bug with the multiple blocks being bumped, you could fix that by only bumping the block that is most aligned with the playersprite, or has the least offset. Be sure not to limit it to just one direction. Blocks can actually be bumped from any direction in Mario. (Above by doing a ground pound in same games, or the drill-spin-thing) (Sides by using a shell)

Sneakyness