Added phaser build and hellophaser sample
This commit is contained in:
3
resources/Project Templates/RequireJS/.bowerrc
Normal file
3
resources/Project Templates/RequireJS/.bowerrc
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"directory": "src/libs"
|
||||
}
|
||||
19
resources/Project Templates/RequireJS/README.md
Normal file
19
resources/Project Templates/RequireJS/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
# Phaser-RequireJS
|
||||
|
||||
Boilerplate project that combines [Phaser](http://phaser.io) with [RequireJS](http://requirejs.org).
|
||||
|
||||
## Structure
|
||||
|
||||
The *Hello World* game is found in `www`. The `www` directory will need a `bower install`. Bower dependencies are configured to install into `www/src/libs`.
|
||||
|
||||
## NOTE
|
||||
|
||||
I haven't yet fully decided whether RequireJS is the right way of modularising a Phaser game.
|
||||
|
||||
|
||||
## Change Log
|
||||
|
||||
### Version 0.1.0
|
||||
|
||||
- Initial project.
|
||||
BIN
resources/Project Templates/RequireJS/assets/phaser.png
Normal file
BIN
resources/Project Templates/RequireJS/assets/phaser.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
20
resources/Project Templates/RequireJS/bower.json
Normal file
20
resources/Project Templates/RequireJS/bower.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "Phaser-RequireJS",
|
||||
"version": "0.1.0",
|
||||
"description": "Phaser Hello World with RequireJS",
|
||||
|
||||
"authors": [
|
||||
"ashatch <andrew@andrewhatch.net>"
|
||||
],
|
||||
|
||||
"license": "MIT",
|
||||
|
||||
"dependencies": {
|
||||
"requirejs": "latest",
|
||||
"phaser": "latest"
|
||||
},
|
||||
|
||||
"ignore": [
|
||||
"src/libs"
|
||||
]
|
||||
}
|
||||
10
resources/Project Templates/RequireJS/index.html
Normal file
10
resources/Project Templates/RequireJS/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>hello phaser-requirejs</title>
|
||||
<script data-main="src/main" src="src/libs/requirejs/require.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
31
resources/Project Templates/RequireJS/src/game.js
Normal file
31
resources/Project Templates/RequireJS/src/game.js
Normal file
@@ -0,0 +1,31 @@
|
||||
define([
|
||||
'phaser'
|
||||
], function (Phaser) {
|
||||
'use strict';
|
||||
|
||||
function Game() {
|
||||
console.log('Making the Game');
|
||||
}
|
||||
|
||||
Game.prototype = {
|
||||
constructor: Game,
|
||||
|
||||
start: function() {
|
||||
this.game = new Phaser.Game(800, 600, Phaser.AUTO, '', {
|
||||
preload: this.preload,
|
||||
create: this.create
|
||||
});
|
||||
},
|
||||
|
||||
preload: function() {
|
||||
this.game.load.image('logo', 'assets/phaser.png');
|
||||
},
|
||||
|
||||
create: function() {
|
||||
var logo = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'logo');
|
||||
logo.anchor.setTo(0.5, 0.5);
|
||||
}
|
||||
};
|
||||
|
||||
return Game;
|
||||
});
|
||||
22
resources/Project Templates/RequireJS/src/main.js
Normal file
22
resources/Project Templates/RequireJS/src/main.js
Normal file
@@ -0,0 +1,22 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
requirejs.config({
|
||||
baseUrl: "src/",
|
||||
|
||||
paths: {
|
||||
phaser: 'libs/phaser/phaser.min',
|
||||
},
|
||||
|
||||
shim: {
|
||||
'phaser': {
|
||||
exports: 'Phaser'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require(['phaser', 'game'], function (Phaser, Game) {
|
||||
var game = new Game();
|
||||
game.start();
|
||||
});
|
||||
}());
|
||||
Reference in New Issue
Block a user