š¹ļø Learn how to program with Code Arcade!
Play
Play in your browser:
Or download for desktop:
How to Play
Code Arcade is a puzzle game where you learn to program by writing and fixing JavaScript code to beat each level.
- Each level presents a play area (the game) and a code editor containing the levelās script.
- Read the instructions in the play area and the comments in the code to figure out the objective.
- Write or fix the JavaScript code in the editor.
- Press Run to execute the code with the KAPLAY.js game engine.
- Use WASD or the arrow keys to move the player (the bean) to the exit door. In some levels you must spawn the exit, collect a key, or fight off enemies.
- Touch the door to advance to the next level.
Buttons:
- āŗ Run: run the code in the editor
- ā³ Restart: restore the editor to the levelās original code
- ā Hint: display a hint in the game console
The console in the play area reports output from
console.log(), errors, and hints.
Features
- 31 levels that teach JavaScript programming concepts:
- Outputting with
console.logand errors - Single-line and multi-line comments
- Data types: strings, numbers, booleans
- Data structures: arrays, objects
- Variables (
let/const), template literals - Functions: declarations, function expressions, hoisting
- Iteration:
forloops,forEach() - Timing:
setTimeout(),setInterval() - Object properties and methods
- JSON:
JSON.stringify(),JSON.parse() - DOM events:
addEventListener - Promises: fulfilled, rejected,
then/catch,async/await - Networking:
fetch()
- Outputting with
- Game built on the KAPLAY.js engine
- In-browser code editor powered by CodeMirror with JavaScript syntax highlighting
- Keyboard (WASD/arrow keys) and mouse controls
- Progress saved when level is cleared
Credits
- Assets from KAPLAY Crew
- Editor from CodeMirror
Background
I joined the GameDev.tv Game Jam 2024, but the theme was Last Stand and I decided not to use it.
I wanted to create a game that could teach programming fundamentalsāsomething like Untrusted but more beginner-friendly.
I chose KAPLAY.js (formerly Kaboom.js) as the game engine because:
- the API is easy-to-use and learn
- the library has a flexible component system
- the functions are injected into the global namespace
I created a prototype where I rendered a CodeMirror editor next to a game canvas. I added a button to āRunā the code from the editor.
But because the game keeps rendering in the same window, the game starts lagging after a few playthroughs due to memory leaks.
So I moved the code to GitHub and refactored the game to render inside an inline iframe to fix the performance issues.
I then added 20+ levels and playtested it with a bunch of people. I iterated on their feedback and adjusted the level difficulty and added hints.
Let me know what you think!