← Camp Home
RBS CODE · COMPLETE EXAMPLES

Complete Game Lab

Here you see the whole project: HTML + CSS + JavaScript + the live result.

1 · Treasure Rush2 · Two-Player Treasure3 · Platform Escape4 · Bonus Laser Rush
Best teaching use: change ONE number first — speed, score needed, gravity, laser delay — and immediately run again.
JS3

1. Treasure Rush

NEW: Treasure + danger + win ruleTOOLS: touching, randomPosition, changeNumber, setText
9Student JS lines
HTML
CSS
YOUR JAVASCRIPT
LIVE GAME
Easy upgrades:
Move the trap20-second timerGold gem worth 5
JS3

2. Two-Player Treasure Battle

NEW: Shared target + two scoresTOOLS: moveWithKeys, touching, randomPosition, changeNumber
13Student JS lines
HTML
CSS
YOUR JAVASCRIPT
LIVE GAME
Easy upgrades:
First to 10Trap steals a pointBonus treasure
PLATFORMER

3. Platform Escape

NEW: Gravity + jump + platformsTOOLS: trackKeys, keyDown, applyGravity, standingOnAny, landOnPlatforms
12Student JS lines
HTML
CSS
YOUR JAVASCRIPT
LIVE GAME
Easy upgrades:
Coins on platformsMoving platformsEnemies
BONUS

4. BONUS · Laser Treasure Rush

NEW: Random danger every few secondsTOOLS: createSprite, setTimeout, move, touching
24Student JS lines
HTML
CSS
YOUR JAVASCRIPT
LIVE GAME
Easy upgrades:
Laser speed 9 → 15Change random delayLose points when hit
YOUR TURN

Game Challenges

Start with the question. Open hints only when you need them.

GUIDED

Challenge 1 · Gold Key Door

Make a player collect a key, hide the key, then open a door only if the key was collected.

Which functions might help? Try to name them before opening the hint.

Hint 1 · functions

moveWithKeys(), touching(), hide(), setText().

Hint 2 · one variable
let hasKey = false;
LEVEL UP

Challenge 2 · Mystery Trader

Collect 3 crystals. When you meet the trader, exchange them for a gold key.

What new idea do you need? An inventory array, then count/remove items.

Hint

Start with let inventory = [];. Use countItem() and removeItems().

CREATE

Challenge 3 · Maze + Treasure

Build at least 4 walls. Put treasure inside. The player must collect it before reaching the exit.

Hint

Use a walls array and moveIfClear(). Then reuse touching().

2 PLAYER

Challenge 4 · Invent a Two-Player Game

Player 1 uses WASD. Player 2 uses arrows. Decide the win rule yourself: race, treasure, tag, battle or something new.

Hint

Call moveWithKeys() twice with different keys.

↑ TOP