Chrono Bender is a 2D paltformer game made in just under two weeks for Gamedev.js 2023 Jam. The theme of the jam was "time" and the main game mechanics revolves around creating time anomalies that slow or stop the time. The game was built using Phaser 3 engine.
Since this code was written under severe time constraints, it clearly doesn't represent how you should write and structure your game code. Game mechanics were also changed quite a bit during development, which only added to code inconsistencies and some duplication. It was also my first time using Phaser 3, so I'm sure many things could be done cleaner and more efficiently.
Nevertheless, I hope the code still could be useful to some. I had lot of fun working on the game and was pleasantly surprised by the Phaser 3 capabilities and the ease of use.
First, download and install latest stable version of Node.js, if you don't have it already.
- Install dependencies with
npm install
command. - To lint code, use
npm run lint
command. - To build and serve in development mode (with hot reloading) run
npm run dev
command. - To build distribution package, run
npm run build
.
There are few ways to help debugging the game:
- To enable physics debug drawing, set
debug: true
inconfig.ts
file. - To enable debug overlay with scene states, set
debug = true
inOverlay.ts
file. - To enable debug drawing for tilemap, uncomment
this.world.enableDebug();
line inGame.ts
file. - To enable debug drawing of turret line of sight, uncomment all commented lines with
lineOfSightDebug
variable inGame.ts
file.
Levels for the game are created/edited with amazing open-source tool Tiled.
You can open Tiled project in assets/levels
and browse existing levels, to get general idea of how they structured.
Layer and property names should be pretty self-explanatory, and you can always look at initTilemap()
method in World.ts
file.
Moving platforms are created via either path (for a platform going back and forth) or polygon (for a platform following a loop).
New levels should be exported to public/assets/levels
and named sequentially.
I'm not an artist, so while few images/sounds I made myself, most of the art for the game was based on existing assets.
- Tileset - Metroidvania Sci-fi Tileset by s4m-ur4i.
- Player sprite sheet - The Robot - Free Sprite.
- Projectiles sprite sheet - Pure Projectile - Magic Effect by Cethiel.
- Shock wave effect sprite sheet - Pixel FX Pack by CodeManu.
- Turret sprite - Assets Free: Space Modular Buildings Kit by Wenrexa.
- Music track - Namaste by Jason.
- Jump, hit wall, anomaly fly, power up pickup sounds - 50 CC0 Sci-Fi SFX by rubberduck.
- Player death sound: - Machine shutting down by Cough-E.
- Anomaly launch, anomaly detonate, turret explosion, turret fire sounds - Sci-fi Sounds by Kenney.
- Player main fire sound - Space Shoot Sounds by Robin Lamb.
- Time field sounds - Reversing Time / Stuck in Time by isaiah658.
Please note, that most of these assets were edited/altered to better fit into the game style.