A quick introduction to scripts

Knowledgebase / A quick introduction to scripts



Let’s start with a classic: Hello world! Every programmer starts off creating this basic program that displays text on screen.

We want the message “Hello, world!” to appear when the game starts. We’ll need to create the script for this, then attach that script to a game object.

First, place a game object on the stage, then right-click on it and choose “Add script”.


To start with, we need an event block to trigger actions. The event block we want needs to activate when the level stars. The right block for the job is “When the level starts”. Find this block under the Events tab, and drag it into the working area.


To display text we need a block called “Create new textfield with text”, and you can find this block under the Draw tab. Drag it inside the “When level starts” block so that the two blocks snap together.


Now type into the emtpy slot “Hello, world!” to complete our script.


Click Save, give your script a name, then close the script editor. Then click PLAY to test it out.


Congratulations! You’ve programmed your first script. Have a play around with more blocks and see what you can create.