Skip to content

Commit

Permalink
Merge pull request #273 from sivaprasath2004/sivaprasath-closes-issue…
Browse files Browse the repository at this point in the history
…-231

[Feature] : User cliked Indicates color
  • Loading branch information
Durgesh4993 authored May 31, 2024
2 parents 425fdf2 + 9b7dcef commit b6861c0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
5 changes: 2 additions & 3 deletions js/box.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Box {

constructor(row, column) {
this.row = row
this.column = column
Expand Down Expand Up @@ -38,17 +37,17 @@ class Box {
return null
}


fillEdge(edge) {
edge.fill()
}

fill(color) {
if (!this.filled) {
this.filled = true
this.remainingEdges = 0
this.ui.style.background = color
this.ui.classList.add("filled")

Game.instance.invokeEvent("boxFill", this)
}
}
Expand Down
5 changes: 3 additions & 2 deletions js/edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ class Edge {
}

//Filling edge
fill() {
fill() {
const player=document.querySelector(".name").textContent
if (!this.filled) {
this.filled = true
this.ui.classList.add("filled")
player==="Player 1"? this.ui.classList.add("Player_1"):player==="Player 2"?this.ui.classList.add("Player_2"):player==="Player 3"?this.ui.classList.add("Player_3"):player==="Player 4"?this.ui.classList.add("Player_4"):player==="Player 5"?this.ui.classList.add("Player_5"):this.ui.classList.add("Player_6")

Game.instance.invokeEvent("edgeFill", this)
}
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,16 @@ a {
transform: scale(0.7, 3);
}

.edge.filled {
background: #111;
.Player_1,.Player_2,.Player_3,.Player_4,.Player_5,.Player_6{
pointer-events: none;
z-index: 10;
}
.Player_1{background: pink;}
.Player_2{background: skyblue;}
.Player_3{background: lightgreen;}
.Player_4{background: magenta;}
.Player_5{background: yellow;}
.Player_6{background: orange;}

.players {
position: absolute;
Expand Down

0 comments on commit b6861c0

Please sign in to comment.