Post Thumbnail
Project

Capital Punishment

JavaScript | Phaser | WebDev




Repository

Capital Punishment is a wave based top-down shooter I created for a Web Based Game Development module in my second year at the University of Brighton. The game can be played in your browser at this link. The game uses JavaScript and the Phaser 3 game engine to handle the basics, such as rendering and the physics systems.


Gameplay GIF

Building the game involved implementing the weapons system, using JavaScript's inheritance to create different weapons with shared behaviour as well as the maths required to orient shots in different directions on the 2D plane.


Additionally, the level is generated using a 'Walker' style grid. This is an approach based on a similar method to the 2D Roguelike 'Nuclear Throne' by Vlambeer. It involves creating fully filled maps where every tile on the grid is representing a wall. Then, in a turn by turn basis, a randomly placed 'walker' carves out the walls by moving in its currently facing direction on each turn. Every turn, the walker has a chance to create a clone on the same tile, facing a random direction, or to be destroyed (if there is another walker able to continue the work), or finally to change its own direction it is tunneling. This continues until a certain percentage of the level has been carved out into walls. This approach of always moving from one tile to another ensures the level always has a continuous path that a player can move through. Changing certain parameters in the generation also changes characteristics of the generated level. Lower chances to turn create more corridor filled levels, while higher chances create wider, more open playing fields.