summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Worthe <justin.worthe@gmail.com>2014-04-21 12:08:55 +0200
committerJustin Worthe <justin.worthe@gmail.com>2014-04-21 12:08:55 +0200
commit8de58b344fdb824e47c1d733d470e9e9cecf74f9 (patch)
tree7692c1f13135b2e40412e3645a8120e21467db3a
parente63dfa8396f37f107ba4b910f555ef5fdf4a9ac7 (diff)
Added wall sprites and hard coded a very basic map
closes #2
-rw-r--r--game/prefabs/wall.js12
-rw-r--r--game/states/play.js42
-rw-r--r--game/states/preload.js3
3 files changed, 55 insertions, 2 deletions
diff --git a/game/prefabs/wall.js b/game/prefabs/wall.js
new file mode 100644
index 0000000..56c7e90
--- /dev/null
+++ b/game/prefabs/wall.js
@@ -0,0 +1,12 @@
+'use strict';
+
+var Wall = function(game, x, y, frame) {
+ Phaser.Sprite.call(this, game, x, y, 'wall', frame);
+
+ // initialize your prefab here
+};
+
+Wall.prototype = Object.create(Phaser.Sprite.prototype);
+Wall.prototype.constructor = Wall;
+
+module.exports = Wall;
diff --git a/game/states/play.js b/game/states/play.js
index 1e9e3e1..ef55d1f 100644
--- a/game/states/play.js
+++ b/game/states/play.js
@@ -1,14 +1,54 @@
'use strict';
+var Wall = require('../prefabs/wall');
+
function Play() {}
Play.prototype = {
preload: function() {
},
create: function() {
+ this.createWalls();
+// this.world.scale = {x:0.5, y:0.5};
},
update: function() {
+ },
+ createWalls: function() {
+ this.walls = this.game.add.group();
+ this.walls.add(new Wall(this.game, 0,0));
+ this.walls.add(new Wall(this.game, 100,0));
+ this.walls.add(new Wall(this.game, 200,0));
+ this.walls.add(new Wall(this.game, 300,0));
+ this.walls.add(new Wall(this.game, 400,0));
+ this.walls.add(new Wall(this.game, 500,0));
+ this.walls.add(new Wall(this.game, 600,0));
+ this.walls.add(new Wall(this.game, 700,0));
+
+ this.walls.add(new Wall(this.game, 0,100));
+ this.walls.add(new Wall(this.game, 700,100));
+
+ this.walls.add(new Wall(this.game, 0,200));
+ this.walls.add(new Wall(this.game, 200,200));
+ this.walls.add(new Wall(this.game, 500,200));
+ this.walls.add(new Wall(this.game, 700,200));
+
+ this.walls.add(new Wall(this.game, 0,300));
+ this.walls.add(new Wall(this.game, 200,300));
+ this.walls.add(new Wall(this.game, 500,300));
+ this.walls.add(new Wall(this.game, 700,300));
+
+ this.walls.add(new Wall(this.game, 0,400));
+ this.walls.add(new Wall(this.game, 700,400));
+
+ this.walls.add(new Wall(this.game, 0,500));
+ this.walls.add(new Wall(this.game, 100,500));
+ this.walls.add(new Wall(this.game, 200,500));
+ this.walls.add(new Wall(this.game, 300,500));
+ this.walls.add(new Wall(this.game, 400,500));
+ this.walls.add(new Wall(this.game, 500,500));
+ this.walls.add(new Wall(this.game, 600,500));
+ this.walls.add(new Wall(this.game, 700,500));
}
-};
+};
module.exports = Play;
diff --git a/game/states/preload.js b/game/states/preload.js
index 877027f..c8b22ad 100644
--- a/game/states/preload.js
+++ b/game/states/preload.js
@@ -12,13 +12,14 @@ Preload.prototype = {
this.load.onLoadComplete.addOnce(this.onLoadComplete, this);
this.load.setPreloadSprite(this.asset);
+ this.load.image('wall', 'assets/images/wall.svg');
},
create: function() {
this.asset.cropEnabled = false;
},
update: function() {
if(!!this.ready) {
- this.game.state.start('menu');
+ this.game.state.start('play');
}
},
onLoadComplete: function() {