why does it do this

This commit is contained in:
Ben
2021-05-06 14:21:27 +01:00
parent 0ead354e62
commit 71f646eb85
3 changed files with 15 additions and 2 deletions

View File

@@ -9,5 +9,6 @@ function computeTurn()
function initGame(boardstate, myplayer, players) function initGame(boardstate, myplayer, players)
{ {
addPiecesToDrawer();
return true;
} }

View File

@@ -173,7 +173,8 @@ function onGameBegin(socket, args)
return; return;
} }
const boardstate = args.game.gamestates[args.game.gamestates.length]; console.log(args);
const boardstate = args.game.gamestates[args.game.gamestates.length-1];
const myplayer = args.gameuser; const myplayer = args.gameuser;
const players = args.game.players; const players = args.game.players;

View File

@@ -18,6 +18,8 @@ Number.prototype.clamp = function(min, max) {
}; };
const Drawer = document.querySelector('#piece-drawer');
/* /*
TILE OBJECT TILE OBJECT
{ {
@@ -29,7 +31,16 @@ let PiecesDrawer = [];
// Returns array of tile IDs that were added // Returns array of tile IDs that were added
function addPiecesToDrawer(pieces) function addPiecesToDrawer(pieces)
{ {
const piece = document.createElement('piece');
piece.innerText = 'A';
piece.classList.add('unselectable');
piece.classList.add('unplayed-piece');
const score = document.createElement('score');
score.innerText = '2';
piece.appendChild(score);
Drawer.appendChild(piece);
setupPieces();
} }
// Removes regardless of vadility // Removes regardless of vadility