Time for action - creating the level editor project

  1. In the Solution Explorer window, right-click on the top-most item that reads Solution 'Gemstone Hunter' (3 Projects) and select Add | New Project....
  2. Select the Windows Game (4.0) project template.
  3. Name the project Level Editor and click on OK.
  4. Right-click on the Level Editor project and select Add Reference....
  5. On the Projects tab of the Add Reference window, select Tile Engine and click on OK:
    Time for action - creating the level editor project
  6. Expand the Gemstone Hunter Content project and right-click on the Fonts folder and select Copy.
  7. Right-click on the Level Editor Content project and select Paste.
  8. Repeat steps 6 and 7 to copy the Textures folder from the Gemstone Hunter Content project to the Level Editor Content project.
  9. Right-click on the Level Editor project in the Solution Explorer window and click on Set as StartUp Project.

What just happened?

Your solution now has five separate projects, the game project (simply called Gemstone Hunter), the game's Content project, the Tile Engine game library, the Level Editor, and the Level Editor's Content project. By setting the Level Editor as the startup project, whenever we execute our code from the development environment, the level editor will be the application that starts (as opposed to starting the actual game). This setting is just a convenience for us while we work on the editor:

What just happened?

Our level editor will use the same content that our real game will use, but we cannot simply add a content reference to the same content project from both "game" projects. XNA Game Studio does allow multiple projects to share a content folder, but only if those projects target different platforms (Windows, Xbox, Windows Phone). Since both of our projects target the Windows platform, we need to duplicate the content project items.

Just like our Gemstone Hunter project, the Level Editor project contains a reference to the Tile Engine project, allowing it to make use of the tile engine code without duplicating it.

Adding a form

We will begin the construction of the level editor by adding a Windows Form to our project and linking it to the XNA Game to allow the output of the game to be displayed on a PictureBox control on the form.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.31.159