Editing the scene

Okay, so we imported our model and made a few tweaks, now it's time to get it into the scene so we can see it in the game. The steps to edit a scene are as follows:

  1. Return to the General view by clicking on General in the upper right-hand corner.
  2. The Game Editor window should still show that the game is loaded. If not, click on Game | Open and select our game.
  3. Switch to the Scene tab and double-click Level1, so that the scene opens in the Scene Viewer window.
  4. Now to load our ship into the scene, all we have to do is drag-and-drop it from the Data Explorer window to the Scene Viewer window.

We can see that the model has appeared in the scene, but it is black again! Don't worry, we just need to add lights to our scene which we will do shortly. Let's switch the Attribute Editor window to the Scene Explorer window to see how the scene updates—click the concentric squares in the upper left-hand corner and select Scene Explorer from the list, as shown in the following screenshot:

Editing the scene

Now we can see that the scene has a default camera, which we are looking through to see the scene, and the ship. The default camera is indicated by the DefaultCamera option, as shown in the following screenshot:

Editing the scene

Eventually, we will have many more assets in the scene such as the cave and obstacles, but in this chapter we are only going to use the ship.

To make our new object more useful, we need to right-click on the ship in the Scene Viewer window or the model name in the Scene Explorer window and select Edit Selection Tag. This will enable us to set a name that we can use to refer to our ship in our code. Let's call it Ship and click on the OK button.

You have been patiently waiting for the lights I promised, so let's add them now. Click on the Models folder in the Data Explorer window and drag-and-drop a DefaultDynamicLightSet model into the scene. This model lights the entire scene no matter where they are located, but their rotation will determine the direction of the object shadows. This is shown in the following screenshot:

Editing the scene

Now we can see the ship details again. Notice that the Scene Explorer window now shows the lights in addition to the ship and the camera.

We are making progress, but we still don't have a functioning scene. If you want to see what happens when we run our game, click on the Play button at the top of the screen. The game controls are similar to a DVD or CD player—you can stop, pause, play, restart, or play one frame at a time. When we click on the Play button, we get a black screen in the Scene Viewer window, because we have not told the game how to load the scene we have been working on—not very exciting. Click on the Stop button and let's make things more interesting by adding some scripting.

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

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