Skip to content
Docs

Your second game: an isometric room

Short tutorial with the editor 0.4.0 on the isometric example: change the view, add coins and a rule to a game with code, see the code that rule writes, export and win it in the launcher.

DescribesEditor 0.4.0 For creating without programming

On this page

In Your first game you started from a blank template and saw no code. Here you do the opposite: you start from the isometric example, which is already a complete game with its hand-written script, and make it yours. Along the way you use Full mode.

The game is called The chest room: you have to find a key, pull a lever that opens a door and reach the chest. You are going to add three coins and a notice on collecting them.

Everything was really done with the published editor 0.4.0 and launcher 0.4.0.

1. Create the game from the example#

  1. On Your games, press New game.
  2. At the top, under How it is programmed, leave Rules or code. Under 1. Kind of game pick Isometric. The template changes by itself to Isometric example.
  3. Type the name, The chest room, and press Create and open.
Isometric kind: the template is the toolkit example.
  1. At the top right, change the switch from Simple to Full.
The newly created example, in Full mode and in the editing view.

What you see is the Editing view: a free camera, in perspective, for building the scene. The game does not look like this when played.

2. Look at the game with its camera#

  1. On the viewport toolbar, press Game. Now you see the scene with the real isometric camera.
  2. Open the menu next to it, the one that says Isometric.
The view menu. The two options specific to the isometric view come turned on.

The two checked options decide how the game is played: the player can turn the view with Z and C, and a click on the ground sends the character there.

  1. Close the menu and click an empty place in the scene, so that nothing is selected. The Details panel shows Game view.
  2. Under Zoom (units in height) change 16 to 20.
With zoom 20 more of the room fits on screen.

The zoom is the world units that fit in the screen height: with 20 you see more of the room than with 16.

  1. Go back to Editing to keep building.

3. Add three coins and a lamp post#

  1. In Place pieces, click Coin and then the floor of the first room. Put two there and a third in the chest room.
  2. Under Scenery and signs, click Lamp post and put it near the chest.
Three coins and a lamp post, placed as in the first tutorial.

Here there is a difference from the first tutorial. This time the coin did not bring its rule: the Rules panel is still empty. In a game made with code Rules are off, and the editor does not add logic to it of its own accord. If you play now, the coins are there but nothing happens when you touch them.

4. Create a rule on top of the game with code#

Open the Rules panel. At the top there is a notice:

This game is made with hand-written code (Code tab). If you add rules, the editor writes them in a separate block inside the same file, without deleting what is there. Both work together.

  1. Press New rule.
  2. Under When pick the player collects…. Leave all and, under Tagged, pick moneda.
  3. Under Then pick show message and type ¡Tienes las tres monedas! and, in English, You got all three coins!.
The new rule. The collects trigger already removes the coin, plays a sound and keeps the count.

The collects trigger does three things by itself: it removes the piece, plays a sound and shows the count on screen ("1 of 3"). The actions you add run when the amount is reached.

The status bar still says No problems. Your rule does not end the match and the editor does not complain: in this game the script ends it, when the player touches the chest.

5. See the code your rule wrote#

Rules are nothing but code: the editor writes it for you, inside the game's own file.

  1. Below the rule, press See the code these rules write. The script tab opens.
  2. To see it with more room, pick the Code layout on the main toolbar.
The block the rule wrote, inside the example's script.

The shaded block, between the marks // <reglas> and // </reglas>, belongs to the editor: it rewrites it every time you touch a rule, so it is not worth changing by hand. Everything outside the marks is the example's script and it is yours. How they live together: Code.

The rest of the game stayed as it was. The example's script records the win in its score table, Best times; when Rules are turned on the editor keeps it and adds its own at the end, High scores.

  1. Go back to the Scene layout.

6. Game card, test and match#

  1. Open Game card. Fill in the name in Spanish (La sala del cofre), the two descriptions and the author.
  2. Go back to the scene, press Game to frame it with its camera and, on the card, Use the current scene view for the cover.
The card, with the cover taken from the game view.
  1. Press Test with bot.
Test passed. The bot uses the route that comes with the example.

The bot does not need the coins to win: it follows the route the example has written in pruebas/bot.json (the key, the lever, the door, the chest). The Rules panel says so: "The route is hand-written in pruebas/bot.json (8 steps). The editor leaves it alone."

  1. To watch it play, open the Play dropdown and pick Watch the bot play.
The bot has just pulled the lever: the door opens.

7. Export and play it in the launcher#

  1. Press Export.
The exported game.
  1. In the launcher, press Import .ggx and pick the-chest-room.ggx. Then, Play.

In the launcher we played it with the mouse, clicking the ground to move the character, and with E to pull the lever once it has the key.

In the launcher, after pulling the lever.
The rule you created, working: the notice on collecting the third coin.
Victory, recorded in the best times table.

The match was really won and the launcher recorded it in its history, in the example's best times table.

What you learned#

StepWhat is new compared with the first tutorial
Create from an exampleThe new kinds start from a game with code
Game viewEditing and Game, the view menu and its parameters in Details
Pieces in a game with codePrefabs do not bring their rule: you create it by hand
Rules and code togetherThe rules block lives alongside the script
The code of the rulesSee the code these rules write and the block between the marks
LauncherA game you move with clicks

Next#