Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SamriddhaKharel committed Apr 26, 2024
2 parents 1adb91b + 2dd1b77 commit 8499946
Show file tree
Hide file tree
Showing 10 changed files with 577 additions and 157 deletions.
12 changes: 6 additions & 6 deletions html/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ connection.onmessage = function(evt){
document.getElementById("lobby").style.display = "none";
document.getElementById("gameArea").style.display = "block";
document.getElementById("grid").style.display = "block";
wordgrid = obj.matrix;
wordgrid = obj.matrixDup;
startTimer();
// modify the game grid
colorgrid = obj.colorGrid;
Expand All @@ -118,19 +118,19 @@ connection.onmessage = function(evt){
document.getElementById(i + "," + j).innerHTML = wordgrid[i][j];

// apply colors using Game.colorgrid;
if(colorgrid[i][j] == 'w'){
if(colorgrid[i][j] == 'W'){
document.getElementById(i + "," + j).style.backgroundColor = "white";
}
else if(colorgrid[i][j] == 'r'){
else if(colorgrid[i][j] == 'R'){
document.getElementById(i + "," + j).style.backgroundColor = "red";
}
else if(colorgrid[i][j] == 'g'){
else if(colorgrid[i][j] == 'G'){
document.getElementById(i + "," + j).style.backgroundColor = "green";
}
else if(colorgrid[i][j] == 'b'){
else if(colorgrid[i][j] == 'B'){
document.getElementById(i + "," + j).style.backgroundColor = "blue";
}
else if(colorgrid[i][j] == 'y'){
else if(colorgrid[i][j] == 'Y'){
document.getElementById(i + "," + j).style.backgroundColor = "yellow";
}

Expand Down
Loading

0 comments on commit 8499946

Please sign in to comment.