Skip to content
Snippets Groups Projects
Commit 4e92482a authored by ys678's avatar ys678
Browse files

Update the UI

parent a22dec32
No related branches found
No related tags found
1 merge request!16Potential restart
......@@ -32,6 +32,14 @@ let gameBoardHandler = (event) => {
widthStep = width / board[0].length;
heightStep = height / board.length;
let coordsDiv = document.getElementById("snakeCoords");
let sizeDiv = document.getElementById("snakeSize");
if (event.headPosition && event.bodySize) {
coordsDiv.innerText = `Coords: (${event.headPosition.x}, ${event.headPosition.y})`;
sizeDiv.innerText = `Size: ${event.bodySize}`;
}
for (let i = 0; i < board.length; i++) {
for (let j = 0; j < board[i].length; j++) {
if (board[i][j].type === 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment