RORY LYONS - JAVASCRIPT GAME ENGINE

JAVASCRIPT GAME ENGINE

The goal of this project was to create a library from scratch that I could use to build games entirely out of HTML5 elements implemented in javascript. I modelled the engine code off of my prior experience using game engines such as unity, therefore some of the code resembles methods you might see when using such game engines.

The engine centres around a core update loop which iterates over all entities that currently exist. I created an entity class which is intended to be used as a parent class for all objects inside of the game. Animation sprites are stored in a folder and the references to these sprites are stored in a json file where they are ordered by the animations that they are a part of.

An example game is playable at the bottom of this page. The game is a version of snake. Although this is a very simple example which doesnt take advantage of animation for most of the sprites (excluding the apple), more complex games are possible and the engine itself has plenty of room for expansion. Such as supporting UI elements and a more sophisticated saving and loading implementation to allow for more complex levels inside of the engine.

The code can be viewed here.