Docs Tutorials
Switches, moving platforms and traps
A lever that opens a gate, a rule that reacts to it, platforms that carry you and traps that hurt.
In the editor: Welcome ▸ Tutorials ▸ 2.2 ▸ ▶ Start goes on in your My Playground project with this lesson's checklist.
Build · about 30 minutes · Basic mode
What you'll make: a lever that opens a gate, a platform ride across a gap, a pressure plate that starts a second platform, and a trap that bites.
What you'll learn: switches, and your first Rules: When something happens, Only if something is true, Do something.
Before you start: do Make it do something: behaviors and triggers. Keep that project open, or start a new one and choose Create ▸ Add Starter Models: the models below are all in that set.
#1. A lever that opens a gate
- Place a Torch to be the lever. In Properties, under What is it?, pick Switch and set its Type to Lever.
- Place the Locked gate in a wall. Make it a Door and set its Type to Opens with a switch. Its Switch says lever: the same name the lever sets, so they work together at once.
Play it now: walk up to the lever and press E. The gate opens.
#2. A rule that reacts
A rule is one line of logic on an object: When something happens, Do something.
- Select the gate. In Properties ▸ Rules, click + Add a rule.
- Set When to a switch turns on. Its Switch box says lever.
- Tick Only once.
- In Do, change the action to Show text (banner) and type
The gate is open!.
Play it now: pull the lever. The gate opens and the banner shows, just once.
#3. A moving platform
- Dig a gap or a pool too wide to jump. Place a Wood floor tile at one side. It's the platform.
- Make it a Platform with the Type Side to side.
- Set Moves sideways (tiles) to the width of the gap, and Seconds each way to how slow you want it.
Play it now: step on. The platform carries you across and back.
#4. A plate that starts a platform
- Place a second Wood floor tile, make it a Platform and set its Type to While a switch is on. Type
bridgein its Switch. - Place the Pressure plate in front of it. Make it a Switch with the Type Pressure plate, and type
bridgein its Switch name.
Play it now: the platform waits. Step on the plate and it starts moving.
#5. Traps that hurt
- Place some Spikes and make them a Hazard. Set Damage.
- For a hidden trap, place a Grass tile on the grass so it looks like the floor. Add a rule: When the player touches it.
- In Do, pick Hurt player and set HP to 20. Click + Add action for Shake screen, and again for Show text (popup) with
A trap!. - Place a Checkpoint before the traps, so a fall or a defeat brings the player back there.
Play it now: walk over the spikes, then the hidden tile. Watch the health bar drop.
#Try it yourself
- Two levers, two gates: give each lever its own Switch name (
gate_a,gate_b) and each gate the matching Switch. - An elevator: a platform with the Type Up and down that lifts you to a ledge.
- A stone that gives a Key only after the plate is pressed: a rule with + Only if… Switch is on, a Give item, and a popup under Otherwise.
#Learn more
- Making things happen.
- Behaviors and items ▸ Triggers and switches.
- Cookbook: Lever puzzle, Moving platform, Hazards.
#Next
Get an email when Voxel Game Maker launches
It's coming to Steam with a launch discount. One email on launch day, the odd progress update, nothing else.