Chapter 14: Creating The Title Screen

We will now begin the script programming! To start, we will customize the title screen.

Getting Started

Open the game and the Game Explorer will load. It will show a list of the game's resources.

| Click on the script folder and the list of scripts in your game will appear on the right, along with a preview of the first script.

| Double click the script named "TitleScreen", and the script editor will open up. TitleScreen is the script containing the code base to create your title screen.

The Script Editor

Start by scrolling down to the TitleScreen instance. It is the first instance in the script.

We will now begin customizing the title screen.

The TitleScreen instance, derrived from the Rm (room) class is where the title screen's execution begins. The init() method is the first code block which is executed.

| Scroll down to the bottom of the init() method until you find the "Display" function. This the a kernel function which displays text on the screen.

This code draws the text "Intro/Opening Screen" to the screen at the coordinates (90,80) in white, with a transparent background.

Begin by changing the text from "Intro/Opening Screen" to "Tutorial Quest".

| Click the "Compile and Run" button. This compiles the code (converts it from the text you type into binary SCI program code). You will see your brand new title screen! Continue to the next game screen and select "File"->"Quit" from the menu. You will return to SCI Studio. That wasn't so hard now, was it?

The first dsCOORD parameter is the X value. It can be any number from 0 to 319, and specifies how much from the left of the screen the text will be. The second is the Y value. It can be any number from 0 to 189, and specifies how much from the top of the screen the text will be.

The dsCOLOUR paramater specifes the colour to use for printing the text. It can be one of 17 different values, defined in SCI.SH as follows:

> clBLACK, clNAVY, clGREEN, clTEAL, clMAROON, clPURPLE, clBROWN, clSILVER, clGREY, clBLUE, clLIME, clCYAN, clRED, clFUCHSIA, clYELLOW, clWHITE or clTRANSPARENT.

The dsBACKGROUND operates identical to dsCOLOUR, except it specifies the colour to use for the background of the text instead of the foreground.

The next step will be to add another Display() call to your title screen to print the text "By <your name>". Set up it's colours and coordinates appropriately. You can adjust the colours and coordinates for the first Display() call as well.

| When done, your code will look something like this.

| Click the "Compile and Run" button and you will see your new title screen.

Your finished title screen will look something like this:

> | For further reading, take a look at the documentation for the Display() function. You will find information on it's other parameters, enabling you to do things such as setting the text's font, and text alignment.

The title screen is now done. In the next chapter, you will learn about scripting the first room!

<< Prev | Next >>