Giter Club home page Giter Club logo

skeleton's Introduction

Skeleton

A skeleton for games built on phaser. It transpiles ES6 JavaScript using 6to5, which facilitates writing very expressive and convenient game code. We have found this to be especially useful when it comes to game development, which seems to benefit from ES6 even more than many other JavaScript projects.

Some ES6 features particularly useful for game development:

Dependencies

Assuming Node.js is installed, the others may be installed via npm.

$ npm install -g bower
$ npm install -g broccoli-cli

Setup

In order to start playing with your new toys, you first need to install the batteries. We will likely include a script to do all this eventually.

# download/extract the skeleton (make sure <gamePath> exists, `curl` doesn't make it)
$ curl -L 'https://github.com/acleverpun/skeleton/archive/master.tar.gz' | tar xz --strip-components=1 -C <gamePath>

$ cd <gamePath>

# change references to "skeleton" to your own <gameName>
sed -i 's:skeleton:<gameName>:' package.json bower.json app/config.js public/index.html

# change or remove the readme
$ vim README.md

# we have this run `bower install` as well, or else that too would be necessary
$ npm install

Development

The .js files in app/ get transpiled and concatenated into a file named main.js. Everything in public/ gets served directly.

One very important thing to keep in mind is that since you can write ES6 code, you can (and should) take advantage of ES6 modules. Consider the following (albeit contrived) example:

// app/entities/enemy.js

class Enemy {
	constructor(name) {
		this.name = name;
	}

	// blah blah blah
}

export default Player;
// app/entities/boss.js

import Enemy from './entities/enemy';

class Boss extends Enemy {
	constructor(name) {
		super(name);

		this.type = 'boss';
	}

	// blah blah blah
}

export default Boss;
// app/main.js

import Boss from './entities/boss';

var boss = new Boss('Larry');

Running

$ broccoli serve

Building for distribution

We have yet to hit this point, but it will be along the lines of running broccoli dist.

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.