mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-06-27 16:10:34 +08:00
Broke play, adding input processing from server
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user