2D game engine in JavaScript