Level Representation in a 2D Game

Posted by meszar.imola on Game Development See other posts from Game Development or by meszar.imola
Published on 2013-06-27T16:39:58Z Indexed on 2013/06/27 22:29 UTC
Read the original article Hit count: 244

Filed under:
|
|

I would like to create a 2D game, where a character should move on a stage/level. My stage would be static, constructed some little cubes, similar to the well-known Mario game: some of the elements should represent an element of the way where the character can step, but if the element is missing, the character should fall.

My problem is, how to represent this programmatically? My first thought was to represent the stage with a vector, which should contain boolean elements, depending on the state of the element on the stage - if it's missing or not. But this means, I have to verify at my character's x or y position change if it has a stage element under or not (if not, to simulate the falling of the character) - I think it is not the best practice, it's not the beautiful solution.

Can you help me with some advice, how to represent the stage?

© Game Development or respective owner

Related posts about 2d

Related posts about architecture