Skip to content

Commit

Permalink
Update "not-here" marker img
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Donot committed Jun 6, 2024
1 parent c3d4b57 commit 9ae0534
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Binary file added img/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script type="module" src="script/db.js"></script>
<script type="module" src="script/pushInDb.js"></script>
<script src="script/chrono.js"></script>
<script src="script/verif_auth.js"></script>
<!-- <script src="script/verif_auth.js"></script> -->
<script src="script/maps.js" defer></script>
<script src="script/constants.js" defer></script>
<script src="script/utils.js" defer></script>
Expand Down
11 changes: 5 additions & 6 deletions script/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ function addClickEventToCases(mapName) {
} else if (gameState[index[1]][index[2]] == 0){ // EMPTY -> MARKER
gameState[index[1]][index[2]] = -1;
imgElement.style.visibility = "visible";
imgElement.style.background = "radial-gradient(circle, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 75%, rgba(0,212,255,0) 76%)";
imgElement.src = './img/close.png';
} else { // MARKER -> QUEEN
gameState[index[1]][index[2]] = 1;
imgElement.style.visibility = "visible";
imgElement.style.background = "rgba(0, 0, 0, 0)";
imgElement.src = './img/crown.png';
}
checkWin(mapName);
}
Expand All @@ -75,20 +75,19 @@ function addClickEventToCases(mapName) {
function changeVisibilityCrownInsideCaseOnClick(event) {
var imgElement = event.target.getElementsByTagName('img')[0];
if (imgElement != undefined) {
startChronometer();

startChronometer();
let index = imgElement.id.split("-");
if (gameState[index[1]][index[2]] == 1){ // QUEEN -> EMPTY
gameState[index[1]][index[2]] = 0;
imgElement.style.visibility = "hidden";
} else if (gameState[index[1]][index[2]] == 0){ // EMPTY -> MARKER
gameState[index[1]][index[2]] = -1;
imgElement.style.visibility = "visible";
imgElement.style.background = "radial-gradient(circle, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 75%, rgba(0,212,255,0) 76%)";
imgElement.src = './img/close.png';
} else { // MARKER -> QUEEN
gameState[index[1]][index[2]] = 1;
imgElement.style.visibility = "visible";
imgElement.style.background = "rgba(0, 0, 0, 0)";
imgElement.src = './img/crown.png';
}
checkWin(mapName);
}
Expand Down

0 comments on commit 9ae0534

Please sign in to comment.