diff --git a/README.md b/README.md index 9ba4ae8..1207761 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,3 @@ A victory state can be stored by taking a snapshot of the current stack. ## Credits Icons from [https://game-icons.net](https://game-icons.net) - -## TODO -- Fix 6 things diff --git a/client/connection.js b/client/connection.js index fe1d88a..69eb810 100644 --- a/client/connection.js +++ b/client/connection.js @@ -3,6 +3,7 @@ const Connection = function() { this.retryCounter = 0; this.name = null; + this.heartbeatTimer = null; this.socketListeners = { open: this.onOpen.bind(this), @@ -53,6 +54,9 @@ Connection.prototype.send = function(json) { Connection.prototype.onOpen = function() { this.retryCounter = 0; + clearTimeout(this.heartbeatTimer); + this.heartbeatTimer = setTimeout(this.ws.send.bind(null, { type: 'heartbeat' }), 30000); + const evt = new Event('L-conn-open'); document.dispatchEvent(evt); }; diff --git a/client/controls.js b/client/controls.js index ae2458a..2384f93 100644 --- a/client/controls.js +++ b/client/controls.js @@ -192,7 +192,7 @@ Controls.prototype.msgState = function(evt) { }; Controls.prototype.msgWin = function(evt) { - document.getElementById('controls-win-message').innerHTML = `Congratulations ${this.names[evt.detail.body.player_id]} !`; + document.getElementById('controls-win-player').innerHTML = this.names[evt.detail.body.player_id]; document.getElementById('controls-win-count').innerHTML = evt.detail.body.moveCount; }; diff --git a/client/grid.js b/client/grid.js index 990beed..4125383 100644 --- a/client/grid.js +++ b/client/grid.js @@ -70,10 +70,10 @@ Grid.prototype.drawWalls = function() { if (i1 === i2) { wall.className = 'content-wall-y'; - wall.style.height = this.squareSideLength + 'px'; + wall.style.height = `${this.squareSideLength + 2}px`; } else { wall.className = 'content-wall-x'; - wall.style.width = this.squareSideLength + 'px'; + wall.style.width = `${this.squareSideLength + 2}px`; } grid.appendChild(wall) @@ -236,10 +236,10 @@ Grid.prototype.drawObjective = function() { star.appendChild(path); star.style.position = 'absolute'; - star.style.left = `${s * this.objective.i}px` - star.style.top = `${s * this.objective.j}px` - star.style.height = `${s}px`; - star.style.width = `${s}px`; + star.style.left = `${s * this.objective.i + 4}px` + star.style.top = `${s * this.objective.j + 4}px` + star.style.height = `${s - 8}px`; + star.style.width = `${s - 8}px`; grid.appendChild(star); }; diff --git a/index.html b/index.html index aca4507..26394d3 100644 --- a/index.html +++ b/index.html @@ -59,7 +59,7 @@