Skip to content

Latest commit

 

History

History
81 lines (49 loc) · 2.35 KB

tutorial2_2.md

File metadata and controls

81 lines (49 loc) · 2.35 KB

Tutorial 2 - Part 2: Create the map

Open sh-leveleditor-dir/levels/black_forest/map.json with Tiled.

Resize the map to these dimensions: width: 18 tiles; height: 11 tiles.

Draw the floor and holes on the path layer as in the screenshot bellow.

map path layer drawing

Use the automapping by pressing Ctrl+M.

Move objects layer all the way to the top in the Layers panel to better see the objects we will create.

map after automapping

Resize the frame of the camera to match the edges of the map.

camera frame resized

Populate the map with objects in Tiled

Create 2 heroes (type: hero), 1 cauldron (type: cauldron), 4 switches (type: switch) and 16 spikes (type: spikes) in objects layer.

💡 See ObjectConfig documentation for more details on the different types of objects you can create in a level.

static objects created

Configure the world objects

We want the spikes to be up at the start of the level: select all spikes and check the enabled custom property in the left panel.

static objects created

When the bottom hero walks on a switch, we want the spikes on the same column to be disabled. To do so we will have to use the spikes triggering system.

Select the left most switch and note its ID property (you can read it in the first line of the left panel). Then select all spikes that are on the same column and write this ID in the triggers property.

set triggers for spikes

Repeat this process for the 3 other columns of spikes.

Now the spikes will be triggered by the switches. 😉

Test the spikes

Package the level:

shutils pack-level levels/black_forest --watch

💡 See shutils manual for more details on the command line tools.

Open the level in the game:

selflessheroes --dev levels/black_forest/level.shlv

Let's test that the spikes are indeed triggered by the switches with a simple code:

a:
step(e)
jump a

test triggers for spikes

The heroes should step all the way to the right without dying in the spikes.

Next: ▶️ Part 3: Create objects programmatically