Thursday, July 16, 2009

Platformer 2

My latest project is a simple platformer game that is pretty bare bones but could serve as the base code for future projects.

My first idea was to make a platformer with an easy to use level editor. Experience has taught me that making a nice UI is difficult/time consuming so I decided to create Scaled Vector Graphics files in Adobe Illustrator and use those to represent my level. This is actually pretty simple and has worked out pretty well. An SVG file is just a text file that describes each shape in the image. Then all I have to do is make up a translation between shapes in the SVG file and levels in my game. For example, a black rectangle represents a regular impassable wall inside my game. So in my code all I have to do is read the SVG file and create walls at the specified location and size from the SVG file. I extended this idea to allow me to place enemies inside the level. Circles represent enemies or the player's spawn. The color of the circle tells the game what type of monster the circle represents or if it represents the player's spawn.




This idea is pretty cool, I think, because anyone who can use Illustrator can make a level for my game. Additionaly, the level maker can visually see the shape of the level as he/she is creating it.

You can download the executable here. Note that the character sprites are from the XNA Platformer Starter Kit and you need to have the XNA redistributable installed.

Importing your own levels is somewhat unimplemented/undocumented at this point, but you should be able to reverse engineering level_1.svg if you're interested. To import your own level name it level_1.svg and overwrite my level_1.svg.

No comments:

Post a Comment