2D JavaScript Platformer
⭠ Go Back

CUBE is a basic 2D platformer programmed in JavaScript using the P5.js library. The game is playable on computers in the window above. Using JavaScript allowed me to easily distribute the game to friends to play and enjoy. In the game, players can move left, move right, and jump. With simple controls the game is easy to grasp. Any further complexity is shown through the level design elements.

I love platformers, so I wanted to create a small project that would allow me to start developing some platformer concepts from a programming standpoint. The game looks simple, but it plays well. I had a great time implementing the game system, such as AABB collision, player movement, and pausing. The game is still in development whenever I have time to code it. It all depends on whether I have some break time during work. At least 99% of the code was written during break times, and I want to keep it that way.

You can view the game's code and development on GitHub:


Gameplay first, graphics later



Initially I had programmed a project involving clicking on boxes to achieve a high score. But I wanted to create something new where the player had direct control over an object and had to overcome challenges. Because I love platformers and am inspired by games like Super Mario Bros. and Celeste, I decided to make a platformer in JavaScript.



Programmed in JavaScript using the P5.js library, which makes drawing items to the canvas element very easy. I developed multiple objects that are reusable, like my base GameObject object. The game first updates GameObjects then draws them to the screen. Individual objects are responsible for user inputs. You can view the code on GitHub by visiting:



The game was constantly played by new and previous users. Each time, they would comment about how the game felt, what they thought should be there, and any unusual behavior they found. I'd add these comments to a list of ideas or changes that had to be made so I could approach them in the future. As I made changes, I'd create a new version of the project in order to preserve version control.