Interfaces

Interfaces allow you to place Fields and Timers in order to create menus, dialogs and windows that the player can interact with.

For more information about Interfaces, please see this page:

Game Recipe #3 – Title Screens

In this Game Recipe, we will discuss making a title screen for your game. We will be using an interface with selectable fields, as well as system triggers.


General

Pointer – moves Fields and Timers around Interfaces easily. The pointer tool can also be used to resize Fields as well.

Field – places Text / Graphic Fields on your Interface.

Units Field – places Units Fields on your Interface.

Graph Field – places Graph Fields on your Interface.

Transition Field – places Transition Single Sprite Fields on your Interface.

Window Field – places Window Fields on your Interface.

Static Sprite Field – places Static Sprite Fields on your Interface.

Camera View Field – places Camera View Fields on your Interface.

Timer/Spawn – used to run a script at specific intervals.

Play Interface – starts testing an Interface.

Test Interface – starts testing an Interface with the option to add additional scripting when the Interface is loaded.


Display

Animate Animations – stops/starts animations from playing on the Interface. This doesn’t affect in-game animations.

Enable Grid – displays a 32×32 pixel grid across the Interface, which is useful for precise Field placement.

Snap to Grid – when ticked, objects will snap to the Interface in 8 pixel increments. Otherwise, they’ll freely position at where the cursor is pointing (excluding Timers).

Background Color – is used to toggle the background color of the Interface editor from black to white. This is useful when dealing with black/white text/graphics.

Enable Icons – turns the various Interface icons like Field/Timer/etc. on/off.

Properties – opens the Interface Properties window.


Layouts

Here you can add, edit and remove different layouts for various devices with different resolutions. You can use the drop down menu to select one of the pre-set resolutions or you can click the “Add” button to the right to set a custom resolution and specify the device/operating system it applies to.


HUD

A Heads Up Display (HUD) is typically used to provide players with critical information at a glance, such as available health, money, equipped Items, score, etc. The set up of your HUD will vary depending on the type of game you’re making and the information you want to display to the user.

Game Recipe #6 – Stamina HUD

In this recipe, we will add a stamina display to an interface for use with the sprint system previously implemented in Recipe #5 – Sprint with Stamina (Using Statistics).


Health/Mana

A Graph Field can be used to represent player health as a pie chart or a horizontal/vertical bar.

To have a Field retrieve the player’s current health, you can use the “Retrieve Value” and “Retrieve Maximum” Field Use Values and then select “Health” and “Maximum Health” (inside the Actor category) from the Use Value window. You can use the same process to display other Statistics (like Mana for example). For more information about Use Value scripting, click here.


Money

A Text / Graphic Field can be used to display available funds as plain text.

Use the “Retrieve Value” Field Use Value and then select “Amount of Money” (inside the Main Party / Game category). For more information about Use Value scripting, click here.


Items/Equipment

A Text / Graphic Field can be used to show a currently equipped Item as an image.

To have a Field retrieve the player’s current held Item, you can use the “Retrieve Value” Field Use Value and then select “Graphic” (inside the Items/Magic category). When asked to select an Item, you can click on the Use Value button again and select “Equipment” (inside the Actor category). Note: You may need to tick the “Include All” check box at the bottom for it to be listed. To retrieve the player’s current equipment, select “(Main)” and then select “Weapon” from the Areas of Equipment section.

You will also need to use the “Retrieve Visibility” Field Use Value to ensure the Field is only visible when an Item is actually equipped. To do this, select “Not Equal” (inside the Structure category) and set “Value 1” to the player’s equipment (as seen above). Then set “Value 2” to “(Value)” (second item in the Use Value window). This will check to see if the player’s equipment is NOT equal to nothing and if so, show the Field with an image of the currently equipped Item. For more information about Use Value scripting, click here.


High Score

A Text / Graphic Field can be used to display a high score as plain text.

Use a Global Variable to store the player’s high score. You can then use the “Retrieve Value” Field Use Value and select your Global Variable from the list at the top of the Use Value window. For more information about Use Value scripting, click here.


Menus are used as a means to navigate to different parts of your game. When you start any game, you are typically greeted with a Main Menu which directs players to start a new game, load an existing save file and exit the game completely.

To set up a Main Menu, you’ll first need to create a new Interface and use the “Introduction” System Trigger, along with a “Show/Hide Interface” event (under the Interfaces category of the Script Editor) to have your Main Menu pop up as soon as your game loads.

Inside the Interface itself, you’ll need to create at least three separate Fields that will act as buttons to start a new game, load a saved game and exit the game completely.

Place your scripts inside the “Activated” Field Trigger or add a “Mouse Down” trigger and ensure that the “Selectable” Field Property is ticked so that players will be able to select your button.


Start New Game

The opening of any game is going to be slightly different from someone else’s. You may decide to open with a cutscene to tell your story or just plop the player straight in with no exposition whatsoever.

One thing you will likely do however is turn off the Main Menu, which can be done using the “Show/Hide Interface” event (under the Interfaces category of the Script Editor). You can then use the “Position Actor” event (under the Actor category) to move the player (“Main”) to a Map where the player can begin their journey or watch a cutscene play out.


Open Saved Game

To check if the player has a save game, you can use the “Save Game Exists Branch” event (under the Game category of the Script Editor). If a save file does indeed exist, then you can use the “Load Game from Slot” event or the “Show Load Game” event to display the default Load Game Interface.

If no save game is present, you can simply repeat the same steps taken in the “Start New Game” section above. You can use the “Activate Field” event (under the Fields category) or create a Custom Event so that you don’t have to copy/paste existing scripts (which can become tiresome when you decide to make changes).

Alternatively, you could use the “Save Game Exists Branch” event inside the “Player enters” Interface Trigger instead and simply use the “Enable/Disable Field” event (under the Fields category) to prevent the button being clicked, if no save data is present.


Exit Game

To exit your game completely, use the “Quit Game” event (under the Game category of the Script Editor). Before exiting, you may want to save the player’s current progress first. To do this select the “Save Game to Slot”, “Show Save Game” event (which will bring up the default Save Game Interface) or the “Save Setting” event (under the Variables / Switches category) for those looking for more precision in the types of data they want to save.