Skip to content

Commit

Permalink
Update js/player.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Smets authored and Filip Smets committed Jan 24, 2013
1 parent a27d888 commit adfc186
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ function Player(world)
{
player.onKeyEvent(event.keyCode, false);
}
this.joystick = new SQUARIFIC.framework.TouchControl(document.getElementById("joystick"), {pretendArrowKeys: true});
this.joystick.on("pretendKeydown",
function (event) {
player.onKeyEvent(event.keyCode, true);
}
);
this.joystick.on("pretendKeyup"
function (event) {
player.onKeyEvent(event.keyCode, false);
}
);

this.spawn();
}
Expand Down Expand Up @@ -329,4 +340,4 @@ Player.prototype.nodeCollision = function(node)
return true;
}
return false;
}
}

0 comments on commit adfc186

Please sign in to comment.