Over the next 10 phases you will design and code your own escape room in HTML, CSS and JavaScript: scenes to explore, hidden clues, locks, an inventory and a ticking clock. On Escape Night the class tries to break out of every room. You are the architect. You are the puzzle maker. You are the coder.
.html file to Downloads. Start of every phase: Open and choose that file. The Studio also keeps a draft in this browser, but your Downloads file is the safe copy..html file that plays in any browser. On Escape Night it runs on your laptop as a station and the class tries to break out.setInterval, or to brainstorm a riddle.Need to log into Minecraft Education, Canva, or any other app that asks you to sign in? Most school and app accounts use the same login: your username is [email protected] (add a number if your name needs one, e.g. firstname.lastname2), and your password is the same one you use to log into your school computer.
Every project has at least one thing to hand in. Log into connect.det.wa.edu.au with your firstname.lastname and computer password, then head to your class and open the Submission section. Handing in more than one file? Zip them together first - total size must stay under 50MB.
Design and code a playable escape room with at least three locks, hidden clues, an inventory and a countdown - fair enough to solve, hard enough to brag about - then watch the class try to escape it on Escape Night.
| Criteria | Trapped (0-1) |
Searching (2-3) |
Unlocked (4) |
Escaped (5) |
Score |
|---|---|---|---|---|---|
| Room Design | No clear story or way out | A setting, scenes to explore and at least one lock | Three or more locks chained in a clear order, with a story that ties them together | A room people talk about: atmosphere, a twist and puzzles that fit the setting | / 5 |
| Code | Room only works with heavy teacher help | Scenes and one lock work using the Studio code | Locks, clues, inventory and clock all work, adapted to your room | Your own changes or new mechanics, and you can explain every function you use | / 5 |
| Puzzle Fairness | Answers can't be worked out from the room | Every answer is somewhere in the room | Clues lead logically to answers, and hints help without giving it away | Satisfying "aha" moments, tested and tuned with real players | / 5 |
| Test & Showcase | No playtest, room not ready | One playtest done, some bugs fixed | Bug log with fixes backed by playtests, room ready on the night | Polished room, a great silent host, fair to every player | / 5 |
| Total | / 20 | ||||
Save downloads one .html file (your whole room). Open loads it back. Play opens your room full screen in a new tab. Reset brings back the demo room - press it twice to confirm.
go() shows one scene and hides the rest, tryLock() checks an answerdiv with class="scene" and its own id. hidden hides it. A button with onclick="go('vault')" shows the scene whose id is vaultVault and vault are different names<div class="scene hidden" id="vault">
<h2>The Vault</h2>
<p>Cold air. Rows of locked boxes. Describe what the player sees here.</p>
<button onclick="go('lab')">Back to the lab</button>
</div>
<button onclick="go('vault')">Open the heavy vault door</button>
.scene {
background: #2b1d14;
border-color: #a0522d;
box-shadow: 0 0 40px rgba(255, 140, 0, 0.25);
}
h1, h2 {
color: #ffb347;
letter-spacing: 2px;
}
go() doesn't match any scene. The status line under the editor shows the error - check spelling and capital letters.#vault { background: linear-gradient(#1c232b, #3b0f0f); }, so the vault feels colder and darker than the rest of the room.tryLock() in the JS tab line by line. It takes the player's guess, trims spaces, makes it CAPITALS, then uses if / else: the right answer runs go(), a wrong one shows a message'ORBIT'<div class="scene hidden" id="safe">
<h2>The Safe</h2>
<p>A dial with letters. It wants a five-letter word.</p>
<input id="lock2" maxlength="5" placeholder="?????">
<button onclick="tryLock('lock2', 'ORBIT', 'msg2', 'vault')">Open</button>
<p id="msg2"></p>
<button onclick="go('lab')">Back</button>
</div>
'ORBIT' works, but 'orbit' never will, because the player's guess is always turned into capitals first.tryLock add let wrongTries = 0;. In its else, add wrongTries = wrongTries + 1; and change the message to 'Locked. Failed tries: ' + wrongTries. Players now see how many guesses they've wasted.reveal() in your JS<button class="hotspot" onclick="reveal('note1')">🪴 The plant pot</button>
<p id="note1" class="hidden clue">Scratched under the pot: ORBIT</p>
.hotspot {
background: transparent;
color: inherit;
border: 1px dashed #556677;
}
.clue {
font-family: 'Courier New', monospace;
color: #9fe8a8;
}
// Show a hidden clue
function reveal(clueId) {
document.getElementById(clueId).classList.remove('hidden');
}
note1, note2, note3. Two clues with the same id means reveal() only ever finds the first one.TIBRO for ORBIT) and put a mirror somewhere in the room as a second clue, or shift every letter one place on (PSCJU) and leave a note saying "one step back". Test it on a classmate.bag is an array, a list that grows. push() adds to it, includes() checks for an item, join(', ') turns it into text for the top barpickUp() and in useItem() must match exactly// Everything the player is carrying
const bag = [];
// Put an item in the bag and hide the button that picked it up
function pickUp(item, buttonId) {
bag.push(item);
document.getElementById(buttonId).classList.add('hidden');
document.getElementById('bag').textContent = bag.join(', ');
}
// Only open the next scene if the item is in the bag
function useItem(item, nextScene, msgId) {
if (bag.includes(item)) {
go(nextScene);
} else {
document.getElementById(msgId).textContent = 'You need something to open this.';
}
}
<button id="keyBtn" onclick="pickUp('key', 'keyBtn')">🔑 Pick up the small key</button>
<button onclick="useItem('key', 'cabinet', 'msg3')">Unlock the cabinet</button>
<p id="msg3"></p>
<div class="scene hidden" id="cabinet">
<h2>The Cabinet</h2>
<p>Inside: a torch and a folded note.</p>
<button onclick="go('lab')">Back</button>
</div>
'key' and 'Key' are different items. Pick one spelling and copy-paste it rather than retyping.useItem, right after go(nextScene);, add bag.splice(bag.indexOf(item), 1); then document.getElementById('bag').textContent = bag.join(', ') || 'empty';. Now the key disappears from the bag once it's been used.setInterval runs a function again and again: every 1000 milliseconds, which is once a second. clearInterval stops itexit and caught scenes, and replace your old escaped scene with the new one'exit' instead of 'escaped'. The Step outside button there stops the clock and shows the time600 to 20 in both places, then change it backlet secondsLeft = 600;
let clock = null;
// Start the clock once (a second click does nothing)
function startClock() {
if (clock !== null) {
return;
}
showClock();
clock = setInterval(function () {
secondsLeft = secondsLeft - 1;
showClock();
if (secondsLeft <= 0) {
clearInterval(clock);
go('caught');
}
}, 1000);
}
// Show the time as minutes:seconds, e.g. 9:05
function showClock() {
const m = Math.floor(secondsLeft / 60);
const s = secondsLeft % 60;
document.getElementById('clock').textContent = m + ':' + (s < 10 ? '0' + s : s);
}
// Stop the clock and show how long the escape took
function escapeRoom() {
clearInterval(clock);
const used = 600 - secondsLeft;
document.getElementById('time').textContent = Math.floor(used / 60) + ' min ' + (used % 60) + ' sec';
go('escaped');
}
<button onclick="startClock(); go('lab')">Enter the lab</button>
<div class="scene hidden" id="exit">
<h2>The Door Swings Open</h2>
<button onclick="escapeRoom()">Step outside</button>
</div>
<div class="scene hidden" id="caught">
<h1>Time's up!</h1>
<p>The lights go out. You are still inside.</p>
</div>
<div class="scene hidden" id="escaped">
<h1>You escaped!</h1>
<p>Your time: <span id="time"></span></p>
</div>
startClock checks if (clock !== null) first - without it, a second click starts a second clock and time drains twice as fast.showClock add if (secondsLeft < 60) { document.getElementById('clock').style.color = 'red'; }. In the last minute the clock turns red.const hints = [
'Something on the wall has a number on it.',
'Plants can hide things underneath.',
'The small key opens something with a door.'
];
let hintsUsed = 0;
// Show the next hint, and take 30 seconds off the clock if there is one
function getHint() {
if (hintsUsed < hints.length) {
document.getElementById('hint').textContent = hints[hintsUsed];
hintsUsed = hintsUsed + 1;
if (typeof secondsLeft === 'number') {
secondsLeft = secondsLeft - 30;
}
} else {
document.getElementById('hint').textContent = 'No hints left!';
}
}
<button onclick="getHint()">💡 Hint (costs 30 seconds)</button>
<p id="hint"></p>
const order = ['RED', 'BLUE', 'GREEN'];
let pressed = [];
// Remember each press; check once enough buttons are pressed
function press(colour, msgId, nextScene) {
pressed.push(colour);
if (pressed.length === order.length) {
if (pressed.join(',') === order.join(',')) {
go(nextScene);
} else {
document.getElementById(msgId).textContent = 'Wrong order. Start again.';
}
pressed = [];
}
}
<button onclick="press('RED', 'msg4', 'exit')">🔴</button>
<button onclick="press('BLUE', 'msg4', 'exit')">🔵</button>
<button onclick="press('GREEN', 'msg4', 'exit')">🟢</button>
<p id="msg4"></p>
useItem, rename it useTwo, give it a second item parameter, and change the test to if (bag.includes(item) && bag.includes(item2)). Now the door needs the fuse and the lever.tryLock('lock2', 'TIBRO'.split('').reverse().join(''), 'msg2', 'vault'). It still unlocks with ORBIT, but anyone peeking at the code sees TIBRO.| Start to escape | Play from the first scene to the escaped scene with no errors in the status line |
| Start to caught | Let the clock run out once and check the caught scene appears |
| Every lock | A wrong answer shows a message, the right answer opens the next scene |
| Every clue | Each answer can be worked out from what's in the room |
| Clock | 600 seconds, starts on the first click, stops when you escape |
After 10 phases your room goes live. Every room gets played, every escape gets timed, and the class votes for the rooms that deserve the Hall of Fame.
Play the demo room, then plan your own // Phase 01