The basic functionality of Bombard360 is finished to the point of what is due for my coursework. Now that I basically need to freeze the repo until classes are over (for grading purposes) I used the free time available to abstract out a lot of the code from Bombard360 into an easy to use framework for other 2D games.

This new framework can be found at this GitHub repo.

To get a feel for how the framework is used, try the following to add a new element to the game.

  1. Draw a new sprite in the next open open row of “SimplePathXna\SimplePathXnaContent\GameplaySheet.png”

  2. In the VS2010 solution, add a new element to the SpriteType (\Sprites\SpriteType.cs) enum that described the object you want to add to the game

  3. Add a new dictionary entry defining the contents of the sprite to SpriteSheetManager (\Sprites\SpriteSheetManager.cs)

  4. Create a new class that inherits GameplayObject (\GameObjects\GameplayObject.cs). In the constructor, pass the location and SpriteType into the protected Initialize method. This will handle most of the graphical setup for the class.

  5. Create a method within your new class with the following signature: public override void Update();, and define the object’s game logic here.

  6. In GameplayObjectFactory (\Factory\GameplayObjectFactory.cs), add a new case to the switch statement that defines the way your new object shall be created

  7. In GameplayState (\States\GameplayState.cs), call the function Add(GameplayObjectFactory.Create(400,400,SpriteType.YOUR_NEW_SPRITE_TYPE)); in the constructor

  8. Run the application, and an instance of your new object should show up on screen at 400,400. If not, then there’s a good chance that a null exception will be thrown before the game can launch, showing you what step you missed in setting the object up.

The benefits I’m finding from using this growing framework is the topic of a future post, but feel free to shoot me an e-mail if there are any problems encountered in getting setup with the project.