Added game state, allow paddle movement
This commit is contained in:
@@ -79,6 +79,16 @@ leavelobby.addEventListener("click", function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
function movePaddle(direction) {
|
||||
connection.invoke("MovePaddle", direction).catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
});
|
||||
}
|
||||
|
||||
function moveUp() { return movePaddle(-1); }
|
||||
function stopPaddle() { return movePaddle(0); }
|
||||
function moveDown() { return movePaddle(1); }
|
||||
|
||||
connection.start().then(function () {
|
||||
console.info(`Connected!`);
|
||||
connectionStatus.textContent = "Connected!";
|
||||
|
Reference in New Issue
Block a user