Game Development Reference
In-Depth Information
The top part of the Build Settings window (Scenes in Build) is where the
scenes that are to be included in the build are dragged to. Figure 12.6 shows
what it looks like after this area is populated for Incursion. Below that is where
the Platform and details of that platform (Windows vs Mac) are defined. Down
at the bottom also includes options to adjust the Player Settings (this is Player
as in the container that holds the game, not the player that is the person
playing the game). There are also the Build and Build and Run buttons. These
will actually output the game as it presently stands.
But don't output yet; for now, just populate the Scenes in Build with Scene-
Opening and Scene-EntryWay and close the window.
Step 43: Populate scenes to be included in the game by dragging the
scene files from the Project panel into the Scene In Build section of the
Build Settings window.
Step 44: Play the game. This time, when the begin button is pressed you'll
be immediately transported to the EntryWay built in past tutorials.
Conclusion
So there's your first script. Well, ok, maybe the second, but hopefully the first
where you understand how things were constructed and why.
There's actually a lot that was covered in this introduction to scripting. You
now know how to construct a block of code, what a function is, several types
of functions, and how to declare variables, and how to populate them in the
editor or populate them via script.
But, there is still lots to do and lots to learn. In the next chapter we'll start looking
at more advanced functionality and setups that will allow the player to enter a
blackened base with a flashlight, find the power switch, and turn everything on.
Homework and Challenges
Challenge 1: Going from the Opening scene to the EntryWay scene works,
but is a little abrupt—everything freezes and then jumps suddenly to the
next scene. Use the OpenButtonsScript to add a big Loading Plate that
comes up when the Begin button is pressed so the player doesn't think
the game has frozen.
Hints:
1.
Remember to build a new GUITexture object.
2.
Account for this new GUITexture in the script both as a variable and when
the variable is populated.
3.
Be sure to pull up this new GUITexture before the command that takes us
to the new level.
4.
Note that in addition to Transform X and Y, there is still a Transform Z. This
determines which GUITexture (if there are several) is closer to the camera,
and thus drawn on top.
Search WWH ::




Custom Search