Hello, world! Displaying text

Knowledgebase / Hello, world! Displaying text

We’re going to make a message appear in your game.

Step 1: Add a script to your game object

First, we need an object to run our script. Note: If you already have a game object in your level, skip to the next step.

ezgif-1175872713

To get a game object, click on the Marketplace icon on the sidebar to the left, and then open the Newton’s Orchard pack. Click Add to your Game.

ezgif-280737745

Select Newton and click in the top-left corner of your level to place him. Then right-click on him and select Add Script.

 

Step 2: Start with an event

Now the script editor is open, and we can make instructions for our game object. Events are instructions that make other instructions happen. Click on the Events tab and drag out “When the Level Starts”.

ezgif-8016958

 

Step 3: Displaying a textfield

Open the Draw tab, and grab “Create new textfield with text”.

ezgif-1235648762

Drag that block inside the “When level starts” block. Then type some text at the end of that block.

 

Step 4: Play your game

Test to see if it works by clicking Play in the top-right. It’ll ask you to save your script, so give your script a name and then click Done.

play

Your message will appear in the top-left corner of your game.

Great job! Don’t forget to save your game. Click Edit, then Level Editor, and in the top-left corner click File, Save Game.