Dungeon Key

Find the key, dodge the ghosts and escape the dungeon. Dungeon Key shows top-down movement, counters, and a door that only opens when you have the key.

Dungeon Key — NutHouse
The Dungeon Key level: a maze of stone wall tiles with a hero top-left, gems, two ghosts, a key top-right and a door bottom-right
Every wall is a 32 pixel Dungeon Floor tile, renamed Wall.

What it shows

Shows: Top-down movement, counters, doors. The level’s Gravity pulls is Off, so the hero walks in four directions like a maze game, not a platform game.

How to play

The arrow keys walk. Pick up the four gems and the key. Ghosts chase you when you come near. Touch one and you go back to the start and lose a life. Walk into the door with the key and you escape. Without it, the door stays shut.

The things in it

HeroHero (top-down) from the library. Arrow keys (8 directions), 4 ways, Speed 40.
WallThe Dungeon Floor tile, renamed. Solid, so nothing walks through it.
Gem, KeyStays still. Four gems and one key.
DoorStays still. It has two animations: stopped (shut) and open.
GhostTwo. Chases another object: Hero, Speed 12, Only when closer than 170 pixels.
Gems, KeysTwo Counters, with Label in front “Gems: ” and “Keys: ”.
Lives, You Escaped, LockedThe two Texts start hidden.

The rules, one by one

Dungeon Key — Events
The Events tab of Dungeon Key
Six rules. The two door rules are the clever part.
WhenHero collides with Gem
DoDestroy GemAdd 1 to GemsAdd 10 to the scorePlay Coin
WhenHero collides with Key
DoDestroy KeyAdd 1 to KeysPlay Power up

Picking things up adds to a counter. Counters are numbers you can test later. See Counter.

WhenHero is overlapping DoorKeys = 0
DoStop HeroSet position of Hero to −6, 0 from HeroShow Locked

With no key, the door is a wall. “Is overlapping” is checked every moment, not only once, so the hero is pushed back 6 pixels every time it tries. The message appears too.

WhenHero collides with DoorKeys > 0
DoChange Door animation to “open”Show You EscapedHide LockedStop HeroStop GhostPlay Power up

With a key, the door swaps to its open picture and the game is won. Everyone stops.

WhenHero collides with Ghost
DoSubtract 1 from the livesSet position of Hero to the startFlash Hero for 1.5 secondsPlay Lose
WhenLives = 0
DoRestart the game

Three changes to try

  1. Two keys. In the Level tab, Alt-drag the key to make a second one somewhere far away. In the Events tab change the two door conditions to Keys < 2 and Keys ≥ 2.
  2. Ghosts that never give up. Click a ghost and change Only when closer than from 170 to 0.
  3. A gem bonus. Add a rule: Gems = 4 and ⚙ Special → Only the first time → Add 1 to the lives. Without “Only the first time” it would give you a life every moment.

Still stuck?

Try the Chocobreak tutorial, open a sample game and read its rules, or look at the questions people ask.