Giter VIP home page Giter VIP logo

mortar-game-stub's Introduction

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.

Downloading

There are a few ways to get this template:

If you use Git:

git clone https://github.com/mozilla/mortar-game-stub.git

Or download the latest version in this ZIP file.

Usage

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 your.computer.ip:8000 (for example, 192.168.0.25) 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.

mortar-game-stub's People

Contributors

jlongster avatar sole avatar casarock avatar 38leinad avatar

Watchers

James Cloos avatar Amber Dunn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.