Skip to content

Commit

Permalink
new change
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchitrathore2004 committed Jun 1, 2024
1 parent 06a2c5f commit 18efc81
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 104 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@ doosra dabane se pehla band ----- doneeeeee
hacker mode

semirico khatam agr ulti side lga to ---- done
undo redo -------
undo redo ------- bug solving left
history of moves ko show kro screen pr aur game khatam hone pr local storage me save kro ----- done
sound effect lgao bhaii ----- done
tank ek side se bullet pass krenge ----- done
directional bullet -----
swap rico ---------
swap rico ---------



abhi kya krna h
1. ek ke baad dusra bhi select hona chahiye ------ very important -------- doneeeee
2. pop up lgao gameover ka aur ussi pe ek reset btn hona chahiye ------- doneeee
3. orientation sahi nahi aa rha h kuch kuch browser me ya big screen me. -------- on the wayyy
4. redo ke bug solve kro ----------
5. HOM rotation pr theek kro ---------
29 changes: 27 additions & 2 deletions bullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ let hitSound = document.querySelector("#hit-sound");
let collideSound=document.querySelector("#collide-sound");
let semiHit=document.querySelector("#semi-hit");
let gameOverSound=document.querySelector("#game-over");
export let gameKhatam = document.querySelector(".start-game");
let check=true;
export function bullet(colourr,directionOfBullet) {
if (colourr == "aqua") {
Expand Down Expand Up @@ -277,13 +278,37 @@ function handleCollision(bullet, piece) {
{
gameOverSound.play();
bullet.remove();
alert("Aqua WON!!! Press the Reset Button to Restart the Game");
gameKhatam.classList.add("game-over");
let newDiv = document.createElement('div');
newDiv.innerHTML=`HURRAYYYY! AQUA WON`;
newDiv.classList.add("texttostart");
let resetDiv = document.createElement('div');
resetDiv.innerHTML="PLAY AGAIN";
resetDiv.classList.add("texttostart");
gameKhatam.appendChild(newDiv);
gameKhatam.appendChild(resetDiv);
resetDiv.addEventListener("click", () => {
location.reload();
});
// alert("Aqua WON!!! Press the Reset Button to Restart the Game");
}
else if (nameTemp[2]=="aqua")
{
gameOverSound.play();
bullet.remove();
alert("Red WON!!!!!! Press the Reset Button to Restart the Game");
gameKhatam.classList.add("game-over");
let newDiv = document.createElement('div');
newDiv.innerHTML=`HURRAYYYY! RED WON`;
newDiv.classList.add("texttostart");
let resetDiv = document.createElement('div');
resetDiv.innerHTML="PLAY AGAIN";
resetDiv.classList.add("texttostart");
gameKhatam.appendChild(newDiv);
gameKhatam.appendChild(resetDiv);
resetDiv.addEventListener("click", () => {
location.reload();
});
// alert("Red WON!!!!!! Press the Reset Button to Restart the Game");
}
}
}
Expand Down
82 changes: 70 additions & 12 deletions hackerMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function undo () {
let backTo=redMoveFrom.slice(-1)[0];
redRedoFrom[u]=backTo;
u++;
arr[backTo].innerHTML=NameOfPiece;
arr[backTo].innerHTML=NameOfPiece.toUpperCase();
arr[backTo].style.backgroundColor="red";
enableDiv(arr[backTo]);
console.log(arr[backTo]);
Expand Down Expand Up @@ -74,13 +74,15 @@ export function undo () {
newSpan.classList.add("afterresetricored");
}
newSpan.classList.add("rotatee");
let emptyThisTemp=redMoveTo.slice(-1)[0];
let emptyThis=emptyThisTemp.slice(3,5);
emptyThis=parseInt(emptyThis)+0;
let A = findAngle(arr[emptyThis]);
newSpan.style.transform=`rotate(${A}deg)`;
arr[backTo].appendChild(newSpan);
arr[backTo].style.backgroundColor="red";
enableDiv(arr[backTo]);
console.log(arr[backTo]);
let emptyThisTemp=redMoveTo.slice(-1)[0];
let emptyThis=emptyThisTemp.slice(3,5);
emptyThis=parseInt(emptyThis)+0;
redRedoTo[v]=emptyThis;
v++
arr[emptyThis].innerHTML="";
Expand All @@ -97,7 +99,7 @@ export function undo () {
if(NameOfPiece!="semirico" && NameOfPiece!="rico")
{
let backTo=aquaMoveFrom.slice(-1)[0];
arr[backTo].innerHTML=NameOfPiece;
arr[backTo].innerHTML=NameOfPiece.toUpperCase();
arr[backTo].style.backgroundColor="aqua";
aquaRedoFrom[w]=backTo;
w++;
Expand Down Expand Up @@ -131,13 +133,15 @@ export function undo () {
newSpan.classList.add("afterresetricoaqua");
}
newSpan.classList.add("rotatee");
let emptyThisTemp=aquaMoveTo.slice(-1)[0];
let emptyThis=emptyThisTemp.slice(3,5);
emptyThis=parseInt(emptyThis)+0;
let A = findAngle(arr[emptyThis]);
newSpan.style.transform=`rotate(${A}deg)`;
arr[backTo].appendChild(newSpan);
arr[backTo].style.backgroundColor="aqua";
enableDiv(arr[backTo]);
console.log(arr[backTo]);
let emptyThisTemp=aquaMoveTo.slice(-1)[0];
let emptyThis=emptyThisTemp.slice(3,5);
emptyThis=parseInt(emptyThis)+0;
aquaRedoTo[x]=emptyThis;
x++;
arr[emptyThis].innerHTML="";
Expand All @@ -156,20 +160,74 @@ export function redo () {
console.log(redRedoFrom,redRedoTo);
console.log(aquaRedoFrom,aquaRedoTo);
let nameOfReq=nameForRedo.slice(-1)[0];
if(nameOfReq.split(" ")[2]=="red")
console.log(nameOfReq);
console.log(nameOfReq.split(" ")[1]);
nameForRedo.pop();
if(nameOfReq.split(" ")[1]=="red")
{
if(nameForRedo.slice(-1)[0].split(" ")[0]!="semirico" && nameForRedo.slice(-1)[0].split(" ")[0]!="rico"){
if(redRedoFrom.slice(-1)[0] && redRedoTo.slice(-1)[0]){
arr[redRedoFrom.slice(-1)[0]].innerHTML="";
arr[redRedoFrom.slice(-1)[0]].style.backgroundColor="cornsilk";
arr[redRedoTo.slice(-1)[0]].innerHTML=nameForRedo.slice(-1)[0].split(" ")[0];
arr[redRedoTo.slice(-1)[0]].innerHTML=nameForRedo.slice(-1)[0].split(" ")[0].toUpperCase();
arr[redRedoTo.slice(-1)[0]].style.backgroundColor=nameForRedo.slice(-1)[0].split(" ")[1];
}
else if(nameOfReq.split(" ")[2]=="aqua")
}
else{
let newSpan=document.createElement('span');
if(nameForRedo.slice(-1)[0].split(" ")[0]=="semirico"){
newSpan.innerHTML="SEMIRICO";
newSpan.classList.add("afterresetsemired");
}
else if(nameForRedo.slice(-1)[0].split(" ")[0]=="rico")
{
newSpan.innerHTML="RICO";
newSpan.classList.add("afterresetricored");
}
newSpan.classList.add("rotatee");
let A = findAngle(arr[redRedoFrom.slice(-1)[0]]);
newSpan.style.transform=`rotate(${A}deg)`;
arr[redRedoTo.slice(-1)[0]].appendChild(newSpan);
arr[redRedoTo.slice(-1)[0]].style.backgroundColor="red";
arr[redRedoFrom.slice(-1)[0]].innerHTML="";
arr[redRedoFrom.slice(-1)[0]].style.backgroundColor="cornsilk";
}
redRedoFrom.pop();
redRedoTo.pop();
}
else if(nameOfReq.split(" ")[1]=="aqua")
{
if(nameForRedo.slice(-1)[0].split(" ")[0]!="semirico" && nameForRedo.slice(-1)[0].split(" ")[0]!="rico"){
console.log("yaha aa rha h");
if(aquaRedoFrom.slice(-1)[0] && aquaRedoTo.slice(-1)[0]){
arr[aquaRedoFrom.slice(-1)[0]].innerHTML="";
arr[aquaRedoFrom.slice(-1)[0]].style.backgroundColor="cornsilk";
arr[aquaRedoTo.slice(-1)[0]].innerHTML=nameForRedo.slice(-1)[0].split(" ")[0];
arr[aquaRedoTo.slice(-1)[0]].innerHTML=nameForRedo.slice(-1)[0].split(" ")[0].toUpperCase();
arr[aquaRedoTo.slice(-1)[0]].style.backgroundColor=nameForRedo.slice(-1)[0].split(" ")[1];
}
}
else{
let newSpan=document.createElement('span');
if(nameForRedo.slice(-1)[0].split(" ")[0]=="semirico"){
newSpan.innerHTML="SEMIRICO";
newSpan.classList.add("afterresetsemiaqua");
}
else if(nameForRedo.slice(-1)[0].split(" ")[0]=="rico")
{
newSpan.innerHTML="RICO";
newSpan.classList.add("afterresetricoaqua");
}
newSpan.classList.add("rotatee");
let A = findAngle(arr[aquaRedoFrom.slice(-1)[0]]);
newSpan.style.transform=`rotate(${A}deg)`;
arr[aquaRedoTo.slice(-1)[0]].appendChild(newSpan);
arr[aquaRedoTo.slice(-1)[0]].style.backgroundColor="aqua";
arr[aquaRedoFrom.slice(-1)[0]].innerHTML="";
arr[aquaRedoFrom.slice(-1)[0]].style.backgroundColor="cornsilk";
}
aquaRedoFrom.pop();
aquaRedoTo.pop();
}
}


Expand Down
9 changes: 5 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div id="box13" class="dabba"></div>
<div id="box14" class="dabba TANK red">TANK</div>
<div class="turn">
TURN <div class="currTurn"></div>
<p class="turn-msg"> TURN </p><div class="currTurn"></div>
</div>
<div id="box15" class="dabba"></div>
<div id="box16" class="dabba"></div>
Expand Down Expand Up @@ -59,10 +59,10 @@
</div>
<div class="timer">
<div class="timer-red">
300
180
</div>
<div class="timer-aqua">
300
180
</div>
</div>
<div id="box29" class="dabba"></div>
Expand Down Expand Up @@ -147,7 +147,8 @@
<div class="right-bullet">RIGHT</div>
</div>
<div class="start-game">
<div class="texttostart">START GAME!!</div>
<!-- <div class="texttostart">GAME OVER!!! <br> PLAY AGAIN -->
</div>
</div>
</div>
<script type="module" src="scriptAll.js"></script>
Expand Down
4 changes: 0 additions & 4 deletions scriptAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ export let rotateObjRight = document.querySelector(".right");
let startBtn=document.querySelector(".texttostart");
let overlay=document.querySelector(".start-game");

startBtn.addEventListener("click", () => {
overlay.style.visibility="hidden";
})

export let reset = document.querySelector(".reset");
console.log(reset);
reset.addEventListener("click", () => {
Expand Down
100 changes: 98 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -391,17 +391,20 @@
position: absolute;
visibility: hidden;
}
.game-over{
visibility: visible;
}
.texttostart{
display: flex;
justify-content: center;
align-items: center;
background-color: rgb(4, 4, 29);
color: white;
height: 200px;
height: 100px;
font-size: xx-large;
cursor: pointer;
transition: color 0.5s ease;
visibility: hidden;
/* visibility: hidden; */
}
.texttostart:hover{
color: aqua;
Expand All @@ -414,7 +417,100 @@
border: 1px solid black;
background-color: darkkhaki;
}
@media screen and (min-width:1439px) and (max-width:2559px){
.playspace{
width: 800px;
height: 800px;
margin-right: 10px;
}
.navigation{
width: 1445px;
}
.timer{
margin-left: 820px;
}
.btns{
margin-left: 1280px;
}
.history{
margin-left: 820px;
}
.start-game{
width: 700px;
margin-top: 520px;
}
.rotation{
margin-left: 870px;
}
.time-message{
margin-left: 990px;
}
.turn{
margin-left: 995px;
margin-top: 100px;
}
}
@media screen and (min-width:1023px) and (max-width:1439px){
.navigation{
width: 1330px;
}
.btns{
margin-left: 1152px;
margin-top: 230px;
}
.playspace{
margin-left: -200px;
}
.history{
margin-top: 40px;
width: 800px;
height: 250px;
margin-left: 500px;
}
.start-game{
width: 700px;
height: 250px;
margin-left: -200px;
margin-top: 280px;
}
.rotation{
margin-left: 840px;
}
.timer{
margin-left: 800px;
}
.time-message{
margin-left: 890px;
}
.currTurn{
margin-left: -15px;
}
.turn{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin-left: 910px;
}
.turn-msg{
margin-left: -15px;
}
.texttostart{
margin-top: 15px;
}

}
@media screen and (min-width:320px) and (max-width:426px){
.start-game{
margin-left: 780px;
width: 1000px;
height: 400px;
margin-top: 280px;
}
.texttostart{
font-size: 60px;
margin-top: 60px;
}
.container{
margin-top: 30px;
margin-left: 0px;
Expand Down
Loading

0 comments on commit 18efc81

Please sign in to comment.