Skip to content

Commit 3406353

Browse files
committed
Webpack boilerplate
1 parent b47f233 commit 3406353

5 files changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Phaser-Webpack
2+
3+
Simple boilerplate project that combines [Phaser](http://phaser.io) with [Webpack](http://webpack.github.io).
4+
5+
## Installation instructions
6+
7+
```
8+
npm install webpack -g
9+
```
10+
11+
## Build instructions
12+
13+
Run the following command to build the game
14+
15+
```
16+
webpack src/entry.js build/bundle.js
17+
```
176 KB
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>hello phaser-webpack</title>
6+
<script src="build/bundle.js"></script>
7+
</head>
8+
<body>
9+
</body>
10+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
var Game = require("./game");
2+
3+
var game = new Game();
4+
game.start();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Path to the Phaser build you want to use
2+
var Phaser = require("../../../../build/custom/phaser-no-physics");
3+
4+
function Game() {
5+
console.log('Making the Game');
6+
}
7+
8+
Game.prototype = {
9+
constructor: Game,
10+
11+
start: function() {
12+
this.game = new Phaser.Game(800, 600, Phaser.AUTO, '', {
13+
preload: this.preload,
14+
create: this.create
15+
});
16+
},
17+
18+
preload: function() {
19+
this.game.load.image('logo', 'assets/phaser.png');
20+
},
21+
22+
create: function() {
23+
var logo = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'logo');
24+
logo.anchor.setTo(0.5, 0.5);
25+
}
26+
};
27+
28+
module.exports = Game;

0 commit comments

Comments
 (0)