I thought it might be useful to go over how I wrote the custom level processor, because after following the example in the documentation I still had some questions.

The Level Classes

I already had the classes that make up my level, because I was using them in the level editor. This is the class diagram of the level objects:

Level Class Diagram

As you can see, it’s pretty straightforward.
The classes on the left hold the Farseer collision entity data. I need to update these to add extra information, such as making the collision entities static or dynamic.
The TextureInstance class represents a single texture drawn on the screen. Note that it doesn’t hold the actual texture, just the name of the texture. The textures themselves are stored in the Level class. This is so that I’m not duplicating textures in memory if I need to draw the same image in multiple places.
The Level class just holds collections of the other classes, the Texture2D images, and the height and width of the level.

(more…)

02
Jul

I’m working on a level editor for creating XNA games.

At the moment, it only supports the 2D game engine I’m working on, but I’m planning to extend both the engine and editor to support 3D graphics (but keeping it to 2D logic for the time-being).

This is what the editor looks like when it loads:
Level Editor
The grid can be turned on or off, and the grid size will be editable in the application settings.

From here, you can load your images, and place them in the level: Level Editor Images Note: game sprites are from Lost Garden.

(more…)