Skip to main content
GameDev.net gamedev.net
🔒 Locked

Making a platformer with angled landscapes

Started by alnite Oct 29, 2008 at 1:08 AM 3 replies 1.7k views
Original Post
alnite
alnite
How do you guys think games such as Sonic, Castlevania SOTN, or Metal Slug handles their angled platforms? Is it a collection of lines connecting to each other, or do you think it's handled with a bitmap mask? Right now I am debating which system I should use for my next game.
Captain P
Captain P
Quote:
Original post by alnite
How do you guys think games such as Sonic, Castlevania SOTN, or Metal Slug handles their angled platforms? Is it a collection of lines connecting to each other, or do you think it's handled with a bitmap mask? Right now I am debating which system I should use for my next game.

A while ago I wrote a collision system / editor prototype where I used collision lines. After a bit of tweaking, this turned out to work quite nicely. I haven't built a bitmask system to compare with, but I'd say that using lines is more memory-efficient and could be more efficient overall due to less comparisons, although I'd have to compare that to be sure.
Actium
Actium
If you were to look through the topics before posting, you might find

http://www.gamedev.net/community/forums/topic.asp?topic_id=512814
http://www.gamedev.net/community/forums/topic.asp?topic_id=512872

And this link of course, describing a method using right triangles
http://jnrdev.72dpiarmy.com/
popsoftheyear
popsoftheyear
What about this (just a thought from the top of my head):

Each tile might have a bool indicating if it is solid (that you can stand on it), and then if it is, it would have a 1D array equal to the width of the tile. This would have the height of the tile at that X position, and you just do your collision detection using this value and whatever you use as your "point of reference" for the sprites foot/base.

No math, no mask... just a compare.

Cheers
-Scott
grimfang4
grimfang4
I made a simple example of this kind of platformer in C++ and SDL and posted it on my site:
http://pubpages.unh.edu/~jmb97/SDL.html

Check it out. It might at least give you some ideas (and you can steal any of the code). It has lots of accelerations that you can adjust to make it feel just right. That example uses only rectangular platforms, but I did extend my personal copy, adding a subclass that does arbitrary lines. If you send me an email I'll send that class to you. I personally find this to be a good approach, since you're not confined to tiles.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.