diff --git a/client/public/scrabble/game.js b/client/public/scrabble/game.js index 76738b8..6780de2 100644 --- a/client/public/scrabble/game.js +++ b/client/public/scrabble/game.js @@ -9,5 +9,6 @@ function computeTurn() function initGame(boardstate, myplayer, players) { - + addPiecesToDrawer(); + return true; } diff --git a/client/public/scrabble/network.js b/client/public/scrabble/network.js index f39f43d..bec5a52 100644 --- a/client/public/scrabble/network.js +++ b/client/public/scrabble/network.js @@ -173,7 +173,8 @@ function onGameBegin(socket, args) 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 players = args.game.players; diff --git a/client/public/scrabble/pieces.js b/client/public/scrabble/pieces.js index 1a74247..aa74a69 100644 --- a/client/public/scrabble/pieces.js +++ b/client/public/scrabble/pieces.js @@ -18,6 +18,8 @@ Number.prototype.clamp = function(min, max) { }; +const Drawer = document.querySelector('#piece-drawer'); + /* TILE OBJECT { @@ -29,7 +31,16 @@ let PiecesDrawer = []; // Returns array of tile IDs that were added 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