Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (21 sloc) 1.66 KB

Game Stub

This is a small game template including a basic render loop where you can move the player around.

This is part of the mortar template collection for building Open Web Apps.


There are a few ways to get this template:

If you use Git:

git clone

Or download the latest version in this ZIP file.


Start a local server to simulate accessing the hosted app from the browser, and trying the Install button flow.

For example:

python -m SimpleHTTPServer 8000

then access localhost:8000 or (for example, using Firefox (Desktop or Mobile), or the Browser app in a Firefox OS simulator (or device).

You'll need to use the IP address when using a physical device. Change the port accordingly, if you're running a webserver in this port already.

Code walkthrough

The game logic is defined in js/app.js. This is where we define the player entity, and set up the render loop, and the input and install handlers. In the interest of keeping things tidy and easy to follow, we have extracted the code for input and install onto two files (js/input.js and js/install.js) that we then reference in index.html, right before js/app.js.

If you're interested in reading more about how game loops work, you are strongly advised to read Anatomy of a video game, an article describing all these topics.