diff options
Diffstat (limited to 'game/states')
-rw-r--r-- | game/states/play.js | 9 | ||||
-rw-r--r-- | game/states/preload.js | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/game/states/play.js b/game/states/play.js index ef55d1f..6d542ca 100644 --- a/game/states/play.js +++ b/game/states/play.js @@ -1,6 +1,7 @@ 'use strict'; var Wall = require('../prefabs/wall'); +var Player = require('../prefabs/player'); function Play() {} @@ -10,11 +11,19 @@ Play.prototype = { create: function() { this.createWalls(); // this.world.scale = {x:0.5, y:0.5}; + this.playerA = new Player(this.game, 100, 200, 'player-a', 0, { + up: Phaser.Keyboard.UP, + down: Phaser.Keyboard.DOWN, + left: Phaser.Keyboard.LEFT, + right: Phaser.Keyboard.RIGHT + }); + this.game.add.existing(this.playerA); }, 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)); diff --git a/game/states/preload.js b/game/states/preload.js index c8b22ad..7154c8f 100644 --- a/game/states/preload.js +++ b/game/states/preload.js @@ -13,6 +13,7 @@ Preload.prototype = { this.load.onLoadComplete.addOnce(this.onLoadComplete, this); this.load.setPreloadSprite(this.asset); this.load.image('wall', 'assets/images/wall.svg'); + this.load.image('player-a', 'assets/images/player-a.svg'); }, create: function() { this.asset.cropEnabled = false; |