Broke play, adding input processing from server

This commit is contained in:
Jeremiah Billmann
2013-06-08 14:16:57 -04:00
parent b6981f21fa
commit dbbbc5bcc4
3 changed files with 46 additions and 17 deletions
+2 -5
View File
@@ -15,19 +15,15 @@ $(function () {
handleInput = function () {
if (keyboard.pressed('left')) {
x -= 1;
GarageServerIO.addPlayerInput('left');
}
if (keyboard.pressed('right')) {
x += 1;
GarageServerIO.addPlayerInput('right');
}
if (keyboard.pressed('down')) {
y += 1;
GarageServerIO.addPlayerInput('down');
}
if (keyboard.pressed('up')) {
y -= 1;
GarageServerIO.addPlayerInput('up');
}
},
@@ -35,12 +31,13 @@ $(function () {
processInputs = function () {
//GarageServerIO.processPlayerInput
//GarageServerIO.processClientInput
},
update = function () {
requestAnimFrame(update);
handleInput();
processInputs();
ctxGameCanvas.clearRect(0, 0, gameCanvas.width, gameCanvas.height);
ctxGameCanvas.fillRect(x, y, 10, 10);