diff options
author | Justin Worthe <justin.worthe@entelect.co.za> | 2014-07-31 16:45:33 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@entelect.co.za> | 2014-07-31 16:45:33 +0200 |
commit | 0a4b32158d6ddd17eb9df21ff5940c736eb8208e (patch) | |
tree | dfba00090556cbb2baf2e4a99d7c3929c0341b49 /game/states/play.js | |
parent | a5718bd0e29a6245d2e82a272a616782187ee283 (diff) |
Attempt at adding orientation based input
Diffstat (limited to 'game/states/play.js')
-rw-r--r-- | game/states/play.js | 13 |
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; |