|
1 | | -# Castle |
2 | | -A HTML5 game developed using akihabara game engine. The main character of the game gets lost in a castle. Use the arrow keys to evade the mummies and find his friend. |
| 1 | +# Castle 🏰🕯️ |
| 2 | + |
| 3 | +> A top-down maze **chase & rescue** — you're lost in a haunted castle. Dodge the mummies, grab the key, rescue your friend and escort them to the exit before the timer runs out. |
| 4 | +
|
| 5 | +[](https://danmat.github.io/Castle/) |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +<p align="center"> |
| 11 | + <img src="docs/screenshot.png" alt="Castle gameplay — a hero in a top-down stone maze with chasing mummies, gems, a friend to rescue and a minimap" width="720" /> |
| 12 | +</p> |
| 13 | + |
| 14 | +## What is it? |
| 15 | + |
| 16 | +The original Castle was a little Akihabara-engine maze game. This is a ground-up |
| 17 | +rebuild in **dependency-free vanilla JavaScript** on a plain canvas that keeps |
| 18 | +the heart of it — run through a castle, dodge the mummies, find your friend — |
| 19 | +and layers on a full arcade loop: **8 generated levels**, torchlight fog, keys, |
| 20 | +power-ups, spike traps, a **rescue-and-escort** objective and an online |
| 21 | +leaderboard. All art is drawn procedurally (no image assets). |
| 22 | + |
| 23 | +## How to play |
| 24 | + |
| 25 | +- 🎮 **Move** with WASD / arrow keys (or drag on touch). The **camera follows you**. |
| 26 | +- 👻 **Mummies, bats and guards** chase you — one touch costs a life (you have 3). |
| 27 | +- 🗝️ Grab the **key**, find and **rescue your friend**, then **escort them to the glowing exit** before time runs out. |
| 28 | +- 💎 Collect **gems** for score (chain them for a **combo**) and **⏳ hourglasses** for more time. |
| 29 | +- ⚡ **Power-ups**: *Freeze* stops the mummies, *Sprint* speeds you up, *Torch* widens your view. |
| 30 | +- ⚔️ Dodge **spike traps**, and lean on the **minimap** to navigate. |
| 31 | + |
| 32 | +## Features |
| 33 | + |
| 34 | +- 🧩 **8 escalating levels** — each a freshly generated maze (endlessly replayable). |
| 35 | +- 🕯️ **Torchlight / fog-of-war** on the darker levels for real "lost in a castle" tension. |
| 36 | +- 👥 **Enemy variety** — shambling mummies (chasers), fast bats, patrolling guards. |
| 37 | +- 🤝 **Rescue & escort** — your friend follows your trail once found. |
| 38 | +- 🏆 **Online leaderboard** (time + treasure + no-hit bonuses) with retro initials entry. |
| 39 | +- 🕹️ Keyboard + touch, fully responsive. |
| 40 | + |
| 41 | +## High scores |
| 42 | + |
| 43 | +The leaderboard uses your browser's **localStorage** out of the box and shares |
| 44 | +an online board across all of these games via a free **Supabase** project. See |
| 45 | +[`docs/supabase.sql`](docs/supabase.sql) for the schema and |
| 46 | +[`js/config.js`](js/config.js) for where the project URL + public key go — the |
| 47 | +board is namespaced by `gameId`, so Castle's scores are separate. |
| 48 | + |
| 49 | +## Play locally |
| 50 | + |
| 51 | +It's a static site — no build step: |
| 52 | + |
| 53 | +```bash |
| 54 | +git clone https://github.com/DanMat/Castle.git |
| 55 | +cd Castle |
| 56 | +python3 -m http.server 8000 # then visit http://localhost:8000 |
| 57 | +``` |
| 58 | + |
| 59 | +## How it works |
| 60 | + |
| 61 | +| File | Responsibility | |
| 62 | +| --- | --- | |
| 63 | +| `js/game.js` | Canvas engine: maze generation, camera, movement/collision, chasing-enemy pathfinding (BFS), fog, items, escort, HUD, state machine. | |
| 64 | +| `js/levels.js` | Pure-data level parameters (size, enemies, timer, torch radius, theme). | |
| 65 | +| `js/leaderboard.js` | Reusable high-score store (Supabase REST + localStorage fallback). | |
| 66 | +| `js/config.js` | Supabase URL/key and game id. | |
| 67 | + |
| 68 | +## Credits |
| 69 | + |
| 70 | +Rebuilt in vanilla JavaScript from the original Akihabara-engine version. |
| 71 | + |
| 72 | +## License |
| 73 | + |
| 74 | +[MIT](LICENSE) © DanMat |
0 commit comments