Running a Scene

This tutorial introduces running a scene

Introduction to Running a Scene

Introduction to Running a Scene

It's complete. The perfect scene. It's cool. It's clever. It's got monsters. They're amazing! Publish it! Hold on. Scenes are cool, but static. Just because there are images in the application, does not mean the game is ready to be published on an app store. The application needs movement, game logic, and many other operations. Any visual item can be placed and manipulated later in code in the general sense.

To load a scene, use the following template:

use Libraries.Game.Game
use Libraries.Game.Scenes.Scene
use Libraries.System.File
        
class Main is Game
    action Main
        StartGame()
    end
        
    action CreateGame
        LoadScene("Scenes/Scene.qs")
    end
        
    action Update(number seconds)
    end
end

This template looks similar to a normal game template, as described in the Games tracks and tutorials. The way this works is that there is a new action, added in Quorum version 8, called LoadScene. This action knows how to read a scene file, process the information inside of it, and load that information into an application. This example is the default that is placed into the blank scene template when creating a scene. For this reason, running the default scene project automatically loads whatever scene was created and starts the game.

As with all computer applications, save often! While Quorum Studio saves automatically when the program is run, it is still good practice to save projects every several minutes. To save, choose the disk Save icon, or use COMMAND+S or CONTROL+S. To run the scene, click the Green RUN arrow, or use COMMAND+R or CONTROL+R. The scene will run, and open a game window with the scene loaded.

Next Tutorial

In the next tutorial, we will discuss Add and Remove Items in Scenes, which describes adding and removing items in scenes in Quorum Studio.