summaryrefslogtreecommitdiff
path: root/game/states/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'game/states/play.js')
-rw-r--r--game/states/play.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/game/states/play.js b/game/states/play.js
index 1c4a926..6ea7611 100644
--- a/game/states/play.js
+++ b/game/states/play.js
@@ -183,6 +183,19 @@ Play.prototype = {
addKeyCaptures(this.playerBControls, this.game.input.keyboard);
this.game.input.gamepad.start();
+
+ this.game.orientation.onLeft.add(function() {
+ this.movePlayer(this.players.children[this.playerTurn], -1, 0);
+ }, this);
+ this.game.orientation.onRight.add(function() {
+ this.movePlayer(this.players.children[this.playerTurn], 1, 0);
+ }, this);
+ this.game.orientation.onUp.add(function() {
+ this.movePlayer(this.players.children[this.playerTurn], 0, -1);
+ }, this);
+ this.game.orientation.onDown.add(function() {
+ this.movePlayer(this.players.children[this.playerTurn], 0, 1);
+ }, this);
},
movePlayer: function(player, deltaX, deltaY) {
var newX = player.x + deltaX;