Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm doing a 2D platformer but I don't know how they are usually built.

The approach I'm looking at is making it tilebased, with ground tiles on bottom row, then platforms on some places in "mid-air" within the array.

Then some physics to add gravity to pull the player down if airborn, and just scroll the map horizontally and check for collisions.

Am I on the right track? Thank you.

share|improve this question
1  
Make sure that the graphics are pixelated if you want to get anywhere. –  akled Jun 26 '12 at 13:08
add comment

3 Answers

up vote 6 down vote accepted

I'm going to share a link with you that someone else had shared with me:

http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/

This page covers several approaches as to how one might implement 2d platformers with both basic and some more advanced mechanics. It doesn't give you straight up code but it does a fantastic job at explaining the techniques so that you should be able to code it without too much trouble.

share|improve this answer
    
That article is very helpful. It doesn't mention background scrolling, though, which can in some cases be challenging. I think the important thing to remember with regards to scrolling is that your tiles (or non-tiled world) have to be translated into pixel positions first based on where the camera is. While most of my programming has been in 3D, it stands to reason that in 2D games you still want to mostly disassociate the camera from the world. In pure side-scrolling platformers you may end up locking the camera vertically to the character while giving them some "play" horizontally, etc. –  gkimsey Jun 26 '12 at 20:27
    
Thank you for the link, just what I was looking for. –  hustlerinc Jun 26 '12 at 23:30
add comment

Try using Tiled, which is a great free map editor. You can build your own level with it, and then load the output file (a XML) into your application (generally Tiled compacts everything with gzip and then converts to base64, but there are libraries to load that).

As for the code, yes. You could see it as a big array.

share|improve this answer
add comment

I would buy the Level UP book: http://www.amazon.com/Level-Up-Guide-Great-Design/dp/047068867X/ref=cm_cr_pr_product_top This is the only one with a broken spine & dog eared pages currently on my shelf.

Also read the author's blog for awesome ideas, particularly his Platformer Primer: http://mrbossdesign.blogspot.ca/2008/10/platformer-primer.html

share|improve this answer
    
Thanks, I'll look into that. –  hustlerinc Jul 12 '12 at 19:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.