My jungle adventure (on your phone)
Chapter 1The Lost Temple
In this tutorial you'll make a third-person adventure in the style of Tomb Raider, in a world made of blocks: an explorer, a jungle, a Maya pyramid with its entrance shut… and an ancient mechanism to open it: push the stone onto the plate. The Golden Idol waits inside. Without writing a single line of code, and all of it on your phone.

Along the way you'll learn:
- Block worlds (voxel style): placing and removing blocks with your finger, and generating a whole jungle with its pyramid in a moment.
- Third person: an explorer with her camera behind her and animations to walk, jump and stand still.
- Touch controls: a joystick and buttons on the screen, to play on a phone.
- New BreynFlow pieces: Push Blocks, the event Pressure Plate and Shake Camera.
- And in part two: variables that change the jump and the speed, a screen with life and ammo, weapons and bullets that get recycled (object pooling), fall damage and enemies that wake up with a message.
This is the version of the tutorial for the editor's touch interface, with pictures of the phone. If you don't know the bottom tabs yet (Scene, View, Inspector, Project, More), the workspace bar and the gestures, look at the chapter The editor on a phone of My first game: it also explains how BreynFlow rules work.
Chapter 2The project
The editor opens in the 3D view with the scene main: a sky, the sun, a camera and a plane.
The explorer brings her own camera and the ground will be blocks, so delete what isn't needed: in the Scene tab, hold your finger on Main Camera and choose Delete. Do the same with Plane.
The drawings and the sounds
This tutorial comes with the drawing of the idol, the sounds of the game and a few more things for part two. With your project open, tap ☰ > Help > Tutorials > My jungle adventure (tutorial) and choose Copy and Open: BreynGINE copies them into the project and opens this page again. (You can also download them here (download the ZIP).)


The Project tab now has the folders sprites (the idol, the bullet, the ammo, the guardian and the weapons), weapons (the weapons in 3D) and sounds (the plate, the stone sliding, the temple door, the jump, the treasure, the sounds of the jungle, the shots...).
Chapter 3Moving around the 3D world
Before building, learn to look around. In the View tab, with the 3D view:
- One finger taps to select, and drags the colored arrows to move what's selected.
- Two fingers: pinch to zoom in or out, and drag to turn the camera around.
- The axes at the top right (X, Y, Z) put the camera facing front, from above or from the side with one tap.

Chapter 4The block world
Above the 3D view there's the Shapes button. Tap it and slide the menu all the way down: there's the section Blocks (Voxel).

Choose Block World. Blocks shows up in the Hierarchy and, in the More tab, its palette (the GridMap panel): grass, dirt, stone, mossy stone, carved stone, log, leaves, planks, sand, water, gold, tall grass and flowers.

Each block is 1 meter wide and has its picture on top, on the sides and below, like in construction games: grass is green on top and earth on the sides. The pictures are copied to the blocks folder of the project the first time.
Chapter 5Generate the jungle
Placing thousands of blocks with your finger would take weeks. To start, let BreynGINE make the jungle: Shapes > Generate Jungle...

- Size: how many blocks wide it is. Leave 48.
- Seed: each number makes a different jungle (the same number, the same jungle). Leave 1, so everything ends up where the tutorial says.
- Leave the four boxes checked: the ground with hills and ponds, the trees, the plants and the Maya pyramid.
Tap Generate.

The pyramid has four floors with carved bands, a great stairway to the south and a temple on top. Inside, it hides a tunnel and a treasure chamber. The entrance is at the foot of the stairway, facing south (towards +Z), and a sand path leads to it.
Chapter 6Building block by block
Now, with your finger: two columns at the entrance of the clearing, one on each side of the path.

To erase, choose the eraser in the bar of the palette and tap the block you want to remove; the pencil goes back to the brush. The picker takes the block you tap, to keep painting with it. When you're done, tap the arrow in the bar of the palette (select): that way taps on the view select things again instead of painting.
Chapter 7The explorer



She comes with everything she needs:
- Her Collider (a capsule) and her Body: boxes of colors, with the legs and arms hanging from their joints.
- A Camera Pivot with a Camera Arm (a SpringArm3D) and the Camera at its tip: the camera stays behind her and, if a wall gets in between, it comes closer instead of going through it.
- An AnimationPlayer with three animations: idle, walk and jump.
- She's already in the group player.
Chapter 8Move, push and jump
With the Explorer selected, go to the Inspector tab, scroll to the bottom and tap Add Component > BreynFlow (Rules Without Code). Then go to the View and slide the workspace bar to BreynFlow.

Make these rules (with New Rule, + Condition and + Action; in the piece search you can type part of the name):
- Move. WHEN: Every Frame. DO: Move with the Controls: tap the piece and, in its settings, set the style to Third Person, Speed 5 and, in Look, the animations idle, walk and jump. And another action: Push Blocks (it already comes with the group pushable).


- Jump. WHEN: Key or Button ui_accept. IF: Is on the Floor. DO: Jump with force 6; Play Sound sounds/jump.wav (see the tip below).
- Jungle sounds. WHEN: Scene Starts. DO: Play Music sounds/jungle.wav, repeating it whole.


Tap the name of each rule ("Rule 1"...) to give it its own.
Chapter 9The touch controls
A phone has no keyboard and no mouse: the explorer needs a joystick to walk and a button to jump. With the Explorer selected, add one more rule:
- Touch controls. WHEN: Scene Starts. DO: Touch Controls (type touch in the search box).
The action comes as "show the touch controls (joystick yes, buttons A = ui_accept)". Tap A = ui_accept and, in its settings, tap Buttons: each button is a pair, its text and the action it presses. Write Jump in New Key and ui_accept in New Value, tap Add Key/Value Pair and delete the A with its trash can.


This is how it plays on a phone:
- The joystick, on the left: it appears where you put your thumb and moves the explorer where the camera looks (Move with the Controls reads it as it is). She turns to where she walks.
- Jump, at the bottom right, presses ui_accept: the Jump rule works as it is.
- A finger anywhere else on the screen turns the camera around the explorer, like the mouse on a computer. Several fingers work at once: walk with one thumb and turn the camera with the other.
Try it!
Save (💾) and tap ▶. Walk around the clearing, jump with Jump and climb the stairway of the pyramid jump by jump. To stop, tap ■ or close the game.

Push Blocks goes right after moving, in the same rule: if the explorer walks into a block of the group pushable, she pushes it.
Chapter 10The door, the plate and the stone
Now, the mechanism of the temple. The three things come from the Shapes button of the 3D view; first tap Main in the Scene tab so they're created in the scene (and not inside the Explorer).
The door: Shapes > Cube, named Door. In the Inspector, Size 3, 4, 1 and Position 0.5, 2, 1.5 (with the filter, type size and then position): it closes the entrance right under the carved lintel. In Look, the texture Stone.
The stone to push: Shapes > Pushable Block. Name it Block and set its Position to 8, 0, 13. It's a stone block of 2 × 2 × 2 meters, already in the group pushable.
The plate: Shapes > Pressure Plate. Name it Plate and set its Position to 8, 0, 9: two pushes away from the block, towards the pyramid.

Chapter 11The mechanism
Select the Block, add BreynFlow to it (Inspector > Add Component) and, in the BreynFlow view, make one rule:
- Slide. WHEN: Message Received: pushed (it gets this message every time it's pushed). DO: Play Sound sounds/stone.wav.
And to the Plate, the rule that opens the temple:
- Open the temple. WHEN: Pressure Plate. The piece says "anything steps on this object": it has two slots, and the first one is the one to change. Tap anything (in the settings it's the field With: what steps on it) and choose A group... > pushable. The second one, this object (the plate that is stepped on), stays as it is. It reads "the group "pushable" steps on this object": this way the plate doesn't react when the explorer steps on it, only to the stone.
- DO: Play Sound plate.wav; another Play Sound door.wav; Shake Camera for 3 s with strength 0.3; Show Message "The entrance of the temple opens!" for 3 s; Move To: the Door, by an offset of (0, -3.9, 0) in 3 s. The door sinks slowly into the ground.

How Push Blocks works: when the explorer walks into the stone for a moment, the stone slides its own size (2 meters), if there's room. If there's a wall, a tree or another block in the way, it doesn't move. And the plate sinks a little while something is on it.
Chapter 12The treasure
The torches: tap Main and + > Point Light, named Torch, at 0.5, 3.5, -5.5. In the Inspector: orange Color (tap the color and set 255, 170, 80), Energy 2, Range 7 and Shadow off (the shadows of point lights are costly, and they aren't needed here). Duplicate it (hold your finger > Duplicate): Torch 2, at 0.5, 3, 0, for the tunnel.

Chapter 13The mist of the jungle
The final touch: mist. In the Hierarchy, tap WorldEnvironment; in the Inspector, tap its Environment to open it and, in Fog:
- Enabled: on.
- Light Color: a very light green (158, 189, 158).
- Density: 0.008.
The trees in the distance fade into the haze, and the clearing of the pyramid looks more hidden.
Chapter 14Let's play!
Save (💾) and tap ▶.



While you play, the BreynFlow view makes each rule blink when it runs (on a phone the game covers the editor: close it with ■ and look at the counter of each rule).
Chapter 15Part two: the three idols
The Lost Temple works. Now let's turn it into a real adventure: three idols instead of one (and the power they give), a screen with life and ammo, damage from high falls, two weapons with bullets that get recycled, ammo pouches and two stone guardians that wake up when the temple opens.
Everything you need was already copied at the start: in sprites, the bullet, the ammo pouch, the guardian, the pistol and the shotgun; in weapons, the pistol and the shotgun in 3D; and in sounds, the shot, the shotgun, the weapon switch, pickup, hurt, the growl, the crumble, the fall and the power of the idols.
Variables to run and jump
For the idols to make the explorer faster and springier, her speed and her jump must live in variables, not in fixed numbers. Select the Explorer and, in her rules:

The sentences change to "speed speed" and "force jump". The game plays the same as before, but now any rule can change those numbers while playing.
The idols count
Select the Idol and, in its rule Take the treasure, add a Change Variable: idols (global) add 1. It goes at the end: move it up to the second place with its ⋮ menu > Move Up. And change the message to "Golden idol {idols} of 3!", for 3 s: between braces, the message shows the value of the variable, so each idol says which one it is.
Now the other two. Hold your finger on the Idol in the Hierarchy and choose Duplicate: you get Idol 2, with the same rules. Set its Position to 0.5, 8, -5.5: inside the temple at the top, reached by the stairway.

The third goes even higher. Select Blocks, choose Gold in the palette (More tab) and paint a gold block on the very top of the pyramid, on the cap of the temple roof (at cell 0, 13, -6). Then duplicate the Idol again: Idol 3, at 0.5, 14, -5.5, on the gold.


The power of the idols
The summit can't be reached with a jump of force 6: the temple wall is 3 meters high. The first two idols will give the explorer the power to climb. Select the Explorer and make two rules:
- The power of the idols. WHEN: Variable Changes: idols (global). IF: Compare Variable: idols (global) is equal to 2. DO: Play Sound power.wav; Show Message "You feel the power of the idols! You jump higher and run faster." for 4 s; Change Variable jump (of the object) set to 9.5; Change Variable speed (of the object) set to 7; and a Particle Burst of 60 particles, size 1.5, for 1 s, at this object.
- The three idols. WHEN: Variable Changes idols (global). IF: idols is equal to 3. DO: Play Sound treasure.wav; Show Message "You gathered the three idols! The Lost Temple is yours." for 6 s.

It doesn't matter in which order the first two are taken: as soon as the count reaches 2, the jump goes from 6 to 9.5 (almost 5 meters) and you can climb from the temple yard to its wall, from there to the roof and from there to the gold on the summit.
Chapter 16Life and the screen
Let's put life and ammo on the screen. First, two settings so it looks right on any screen. Open ☰ > Project > Project Settings:
- Type stretch in the search box, tap Window and set Stretch > Mode to canvas_items: the screen grows with the window.
- Type texture filter, tap Textures (in Rendering) and set Default Texture Filter to Nearest: pixels look sharp.
Go to the 2D view (in the workspace bar): the blue rectangle is the screen, 1152 × 648. Tap Main in the Hierarchy and, with + (section UI), add four things:
- Text named Life: with the text LIFE: 100, font size 28 (Theme Overrides > Font Sizes), at Position 24, 596 (bottom left).
- Text named Ammo: BULLETS: 12 SHELLS: 4, size 28, Position 580, 596.
- Image named Pistol: sprites/pistol.png in its Texture, Expand Mode set to Ignore Size and, in Layout > Transform, Size 96, 52 and Position 1032, 584 (bottom right).
- Image named Shotgun: sprites/shotgun.png, Ignore Size, Size 128, 48, Position 1008, 588. Hide it with the eye in the Hierarchy: you start with the pistol.

The rules of the screen
Add BreynFlow to the Life text with these rules:
- Start. WHEN: Scene Starts. DO: four Change Variable, all global: life set to 100, bullets set to 12, shells set to 4 and weapon set to "pistol" (type the word, no quotes).
- Show the life. WHEN: Variable Changes: life (global). DO: Change Text of this object to "LIFE: {life}".
- Show the ammo. WHEN: Variable Changes: bullets (global). DO: Change Text of the object Ammo to "BULLETS: {bullets} SHELLS: {shells}".
- Show the shells: the same, but WHEN shells changes (duplicate the previous one with its ⋮ menu > Duplicate Rule and change only the variable).
- Show the weapon. WHEN: Variable Changes: weapon (global). DO: If / Otherwise. Inside, the condition Compare Variable: weapon (global) is equal to "pistol". In then: Show or Hide Pistol (show) and Show or Hide Shotgun (hide). In otherwise: the other way round.
Falling from high
A tall pyramid and a 5-meter jump call for a little care. Select the Explorer and add:
- Fall. WHEN: Lands or Hits a Wall (it comes as "this object lands"). IF: Compare Variable: fall_height (of the object) is greater than 3.5. DO: Change Variable life (global) subtract 20; Play Sound fall.wav; Shake Camera 0.5 s with strength 0.2; Blink this object for 1 s.
- Die. WHEN: Variable Changes: life (global). IF: life (global) is less or equal to 0. DO: Show Message "You fell in the Lost Temple..." for 2 s; Fade Screen to the color in 1.5 s; Restart Scene.
Every time a character lands, BreynFlow writes in its variable fall_height how many meters below the place where it left the floor it landed: a jump on flat ground is 0, however high; going down a step, 1; falling from the temple roof to the yard, 4. The fade takes 1.5 s to cover the screen, and then the scene starts again: the Start rule of Life sets the life back to 100.
Chapter 17The weapons
The bullet
First, the projectile. It's a small object with its own rules, which we'll save as a prefab (a scene of its own) so the explorer can throw copies.
- Hit. WHEN: Collision: tap the group "player" and change it to the group enemies. DO: Send Message "hurt" to the other object (the field To: what it touched); Particle Burst of 16 particles of orange at the other object; Destroy this object.
- Crash. WHEN: Collision, but this time clear the group (in the settings, the field With empty: "touches anything"). IF: Is in Group: the other object is in the group player... and in the ⋮ menu of the condition check Invert (NOT): the bullet is destroyed when it touches anything but the explorer. DO: Destroy this object.


The action to switch weapons
Input actions are defined in ☰ > Project > Project Settings > Input Map. A new project already comes with jump, shoot, interact and pause. Add one: type switch_weapon in Add New Action and tap Add.

On a phone, a touch button will press it, so it doesn't need a key. If you're also going to play on a computer, give it the Q key: tap the + of its row, type Q in Filter Inputs, choose the Q in Keyboard Keys and tap OK.
The weapons in her hand
The weapons folder has two models made of boxes: pistol.tscn and shotgun.tscn. In the Hierarchy, unfold the Explorer and her Body. Hold your finger on Right Arm, choose Instantiate Child Scene... and pick weapons/pistol.tscn: it goes inside the arm. Set its Position to 0, -0.8, -0.05: now she holds it. Do the same with shotgun.tscn, with Position 0, -1.05, -0.05, and hide it with the eye: she starts with the pistol.

The origin of each weapon (the point you move with its Position) is at the muzzle: that's where the bullets will come out. And since the weapon is inside the arm, it moves with it: it swings when she walks, and rises with the arm when she aims.
Aiming
First, the camera over the shoulder. In the Hierarchy, unfold the Explorer's Camera Pivot, tap the Camera Arm and set its Position to 0.9, 0, 0: the camera moves to the explorer's right shoulder. Shots go where the center of the screen points, so now you can see where they go.
Now select the Explorer and add two rules:
- Aim. WHEN: Key or Button: mouse_right is pressed. DO: Aim (in Characters and Physics): it comes as "this object starts aiming".
- Stop aiming. WHEN: Key or Button: mouse_right is released. DO: Aim, changing "starts aiming" to stops aiming.
mouse_right is the right mouse button, and on a phone it will be the Aim touch button. While it's held, the explorer turns to where the camera looks and raises her arm with the weapon towards the center of the screen; the camera comes closer over her shoulder, a crosshair shows in the middle and she walks slower.
Shooting
Select the Explorer and add three more rules:
- Switch weapon. WHEN: Key or Button: switch_weapon is pressed. DO: Play Sound switch.wav; If / Otherwise with the condition weapon (global) is equal to "pistol"; in then: Change Variable weapon set to "shotgun", Show or Hide Body/Right Arm/Pistol (hide) and Show or Hide Body/Right Arm/Shotgun (show); in otherwise: weapon set to "pistol" and the two weapons the other way round.
- Shoot the pistol. WHEN: Key or Button: mouse_left is pressed. IF: weapon (global) is equal to "pistol", and bullets (global) is greater than 0. DO: Aim with aims briefly (0.4 s: if you shoot without aiming, she raises the weapon for the shot); Throw (Projectile): in the settings, Scene bullet.tscn, From the object Body/Right Arm/Pistol, Direction where the camera looks, Speed 25; Change Variable bullets subtract 1; Play Sound shot.wav.
- Shoot the shotgun. WHEN: mouse_left is pressed. IF: weapon is equal to "shotgun", and shells (global) is greater than 0. DO: Aim with aims briefly; three Throw (Projectile) like the pistol's, but From Body/Right Arm/Shotgun and with Spread 12 degrees (a fan of pellets); Change Variable shells subtract 1; Play Sound shotgun.wav; Shake Camera 0.2 s with strength 0.15.
Bullets get recycled: when one leaves the screen or is destroyed, it goes back to a reserve (an object pool) and the next shot reuses it instead of creating another. With hundreds of shots, the game doesn't choke creating and deleting objects. It's the Reuse setting of Throw, which comes on.
The weapon buttons
You still can't shoot on a phone. Select the Explorer, go to her Touch controls rule, tap the buttons and add three more pairs, as you did with Jump: Shoot = mouse_left, Aim = mouse_right and Weapon = switch_weapon.

The weapon rules don't change: Shoot and Aim press the mouse buttons, and Weapon presses switch_weapon. While you hold Aim, she aims; when you let go, she stops. And touching the screen away from the buttons doesn't shoot: it only turns the camera.
Ammo
Bullets run out. Tap Main and add + > Pickup (3D), named Pouch, at -4, 0, 12, with the texture sprites/ammo.png in its Drawing. Its rule:
- Pick up. WHEN: Collision (touches the group player). DO: Change Variable bullets (global) add 12; shells (global) add 4; Play Sound pickup.wav; Destroy this object.

Duplicate it twice: Pouch 2 at 5, 0, 16 (by the path) and Pouch 3 at 0.5, 0, -3.5 (inside the treasure chamber, right out of the tunnel: you're going to need it).
Chapter 18The guardians of the temple
Inside the treasure chamber, two stone jaguars wait for someone to open the door.

- Start. WHEN: Scene Starts. DO: Change Variable life (of the object) set to 100; awake (of the object) set to 0.
- Wake up. WHEN: Message Received: wake_up. DO: awake set to 1; Play Sound growl.wav.
- Chase. WHEN: Every Frame. IF: awake (of the object) is equal to 1. DO: Move Towards (Follow): towards the Explorer, speed 3.5, and in the settings Stop Distance 1.2.
- Bite. WHEN: Time Passes: every 1 s. IF: awake is equal to 1, and Distance from this object to the Explorer less than 1.8. DO: Change Variable life (global: the explorer's) subtract 15; Play Sound hurt.wav; Blink the Explorer 0.5 s; Shake Camera 0.3 s with strength 0.25.
- Hurt. WHEN: Message Received: hurt (the one the bullet sends). DO: life (of the object) subtract 34; Blink this object 0.2 s.
- Defeated. WHEN: Variable Changes: life (of the object). IF: life (of the object) is less or equal to 0. DO: Play Sound crumble.wav; Particle Burst of 40 gray particles, size 1.5; Destroy this object.

Notice the two lives: the life of the object is the guardian's (each one has its own, even though they share rules) and the global life is the explorer's. Three pistol bullets (34 × 3) or a good shotgun blast up close finish a guardian.

Chapter 19Let's play! (part two)
Save (💾) and tap ▶. The screen says LIFE: 100 and BULLETS: 12, with the pistol.




If the life reaches 0, the screen fades to black and the adventure starts again.
Chapter 20What now?
You have your own adventure! Some ideas to keep going:
- A two-plate puzzle: two stones, two plates and a variable that counts how many are pressed; the door only opens with both.
- Traps: a hidden plate in the tunnel that, when the explorer steps on it, drops a block or restarts the scene.
- Guardians in the jungle: duplicate a Guardian, put it among the trees and swap its Wake up rule for a Distance to the explorer: it sleeps on patrol until you come close.
- Another weapon: a bow with Throw (Projectile) at a lower speed and an arrow prefab that hurts more.
- Score: a global variable that goes up with each defeated guardian and shows on the screen.
- Build: a bridge of planks over a pond, a tree house... with the palette and On Blocks.
- Another jungle: Shapes > Generate Jungle with another seed or bigger (without the pyramid, if you've already placed your things).
