diff options
author | Justin Worthe <justin.worthe@gmail.com> | 2014-04-21 17:14:01 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@gmail.com> | 2014-04-21 17:14:01 +0200 |
commit | a9ba8a68d61110cca347e2a4823b25880bc94923 (patch) | |
tree | cb5c6e2924157554e339134e06f58faf6b98ab2b /game/states/play.js | |
parent | 0347cdee4f8c0cdb90848f300ff831ab30fd3007 (diff) |
Added player with movement
Unfortunately, can currently go through walls.
re #3
Diffstat (limited to 'game/states/play.js')
-rw-r--r-- | game/states/play.js | 9 |
1 files changed, 9 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)); |