Skip to content

Commit

Permalink
Merge branch 'main' into ayush
Browse files Browse the repository at this point in the history
  • Loading branch information
katareayush committed Jun 4, 2024
2 parents 9c81623 + e3e520d commit efd7e2b
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 37 deletions.
115 changes: 108 additions & 7 deletions game.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

document.addEventListener('touchmove', function(e) {e.preventDefault();}, false);
document.addEventListener('touchstart', function(e) {e.preventDefault();}, false);
alert("welcome to the Squared Game");
// alert("welcome to the Squared Game");


var canvas = document.getElementById('game');
Expand Down Expand Up @@ -1359,29 +1359,71 @@ var presstobegin = introstart.ptb;

var squaredlines = new NewGame();

// var scorealert = function () {
// if (squaredlines) {
// var score = squaredlines.i.score;
// if (score<500) {
// alert(score+' bricks computed. Next time work harder.');
// } else {
// alert(score+' blocks. You are a computer. Go compute.');
// }
// }
// };

// function showLevelCompleteMessage(level) {
// alert("Congratulations! You have completed level " + level + ". Moving to the next level!");
// }


// GameStatusChanger.end = function () {
// console.log("Game end function called");
// scorealert();
// //scorealert();
// squaredlines.newgame();
// };

// Function to display the modal with a custom message
function showModal(message) {
var modal = document.getElementById("myModal");
var modalMessage = document.getElementById("modalMessage");
var span = document.getElementsByClassName("close")[0];

modalMessage.textContent = message;
modal.style.display = "block";

span.onclick = function() {
modal.style.display = "none";
}

window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
}

var scorealert = function () {
if (squaredlines) {
var score = squaredlines.i.score;
if (score<500) {
alert(score+' bricks computed. Next time work harder.');
if (score < 500) {
showModal(score + ' bricks computed. Next time work harder.');
} else {
alert(score+' blocks. You are a computer. Go compute.');
showModal(score + ' blocks. You are a computer. Go compute.');
}
}
};

function showLevelCompleteMessage(level) {
alert("Congratulations! You have completed level " + level + ". Moving to the next level!");
showModal("Congratulations! You have completed level " + level + ". Moving to the next level!");
}


GameStatusChanger.end = function () {
console.log("Game end function called");
scorealert();
//scorealert();
squaredlines.newgame();
};


GameStatusChanger.nextlevel = function () {
console.log("Next level function called");
console.log("Current level:", squaredlines.i.level);
Expand Down Expand Up @@ -1414,3 +1456,62 @@ GameStatusChanger.win = function () {
alert(score+' blocks make for a nice computing indeed.');
squaredlines.newgame();
};


function showDialog() {
document.getElementById('dialogBox').style.display = 'block';
document.getElementById('overlay').style.display = 'block';
}

function closeDialog() {
document.getElementById('dialogBox').style.display = 'none';
document.getElementById('overlay').style.display = 'none';
}

// Show the dialog box when the page loads
window.onload = showDialog;


// function showDialog(message, callback) {
// const dialogBox = document.getElementById('dialogBox');
// const overlay = document.getElementById('overlay');
// const dialogMessage = document.getElementById('dialogMessage');
// const dialogButton = document.getElementById('dialogButton');

// dialogMessage.textContent = message;

// dialogBox.style.display = 'block';
// overlay.style.display = 'block';

// dialogButton.onclick = function() {
// dialogBox.style.display = 'none';
// overlay.style.display = 'none';
// if (callback) callback();
// };
// }

// var scorealert = function () {
// if (squaredlines) {
// var score = squaredlines.i.score;
// if (score < 500) {
// showDialog(score + ' bricks computed. Next time work harder.');
// } else {
// showDialog(score + ' blocks. You are a computer. Go compute.');
// }
// }
// };

// function showLevelCompleteMessage(level) {
// showDialog("Congratulations! You have completed level " + level + ". Moving to the next level!");
// }

// GameStatusChanger.end = function () {
// console.log("Game end function called");
// scorealert();
// squaredlines.newgame();
// };

// // Call this function to start the game and initialize the dialog
// window.onload = function() {
// showDialog("Welcome to the Squared Game");
// };
171 changes: 141 additions & 30 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8"/>
<meta charset="utf-8" />
<meta name="author" content="Heartland Games">
<meta name="msapplication-tap-highlight" content="no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, user-scalable=no"/>
<meta name="viewport" content="width=device-width, user-scalable=no" />

<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<meta name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script src="https://kit.fontawesome.com/a2c23c1a99.js" crossorigin="anonymous"></script>
<style>
body {
background-color: #1e1e1e; /* Dark gray background */
background-color: #1e1e1e;
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
perspective: 1000px; /* Add perspective for 3D effect */
perspective: 1000px;
}

.background-layer {
position: absolute;
top: 0;
Expand All @@ -34,28 +36,32 @@
transform: translateZ(-100px); /* Move background layer back */
z-index: 0;
}

.background-layer:nth-child(2) {
background: radial-gradient(circle, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.2));
animation-duration: 60s;
transform: translateZ(-200px); /* Move second background layer further back */
z-index: 0;
}

@keyframes rotate {
from {
transform: rotate(0deg);
}

to {
transform: rotate(360deg);
}
}

footer{
footer {
text-align: center;
color: #fff;
z-index: 1;
position: relative;
}
.con{

.con {
font-size: 2rem;
color: #fff;
}
Expand All @@ -68,32 +74,137 @@
position: relative;

}
</style>


<title>Squared Lines</title>
<link rel="icon" type="image/x-icon" href="./favicon.ico">

#dialogBox {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 20px;
background: linear-gradient(135deg, #ADD8E6, #90EE90);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
z-index: 1000;
border-radius: 8px;
}

#dialogBox h2 {
margin: 0;
margin-bottom: 10px;
}

#dialogBox button {
margin-top: 10px;
border: none;
background-color: transparent;
color: black;

}

#dialogBox button:hover {
color: darkgreen;

}

#dialogBox button:active {
color: darkgreen;

}

#overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
}


.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.4);
padding-top: 60px;
}

.modal-content {
background-image: linear-gradient(to bottom right, rgb(255, 255, 208), rgb(255, 192, 203));
margin: 5% auto;
padding: 20px;
margin-top: 200px;
border: 1px solid #000000;
width: 30%;
}


.close {
color: #000000;
font-size: 14px;
font-weight: bold;
}

.close:hover,
.close:focus {
color: rgb(13, 146, 1);
text-decoration: none;
cursor: pointer;
}
</style>

<title>Squared Lines</title>
<link rel="icon" type="image/x-icon" href="./favicon.ico">
</head>

<body>
<div class="background-layer"></div>
<div id="container">
<canvas id="game"></canvas>
<footer>
<h2>Made by ❤️ by Chrome Gaming </h2>
<p> Connect with Me </p>
<div class="social">
<a class="con" href="https://www.linkedin.com/company/chromegaming/"><i class="fa-brands fa-linkedin"></i></a>
<a class="con" href="https://github.com/GameSphere-MultiPlayer"><i class="fa-brands fa-github"></i></a>
<a class="con" href="https://discord.gg/rZb46cCMmK"><i class="fa-brands fa-discord"></i></a>
<a class="con" href="mailto:[email protected]"><i class="fa-light fa-square-envelope"></i></a>
</div>
<div class="background-layer"></div>
<div class="background-layer"></div>
<div id="container">
<canvas id="game"></canvas>
<footer>
<h2>Made with ❤️ by Chrome Gaming</h2>
<p>Connect with Me</p>
<div class="social">
<a class="con" href="https://www.linkedin.com/company/chromegaming/"><i
class="fa-brands fa-linkedin"></i></a>
<a class="con" href="https://github.com/GameSphere-MultiPlayer"><i class="fa-brands fa-github"></i></a>
<a class="con" href="https://discord.gg/rZb46cCMmK"><i class="fa-brands fa-discord"></i></a>
<a class="con" href="mailto:[email protected]"><i
class="fa-light fa-square-envelope"></i></a>
</div>
<p class="opyright">© Copyright Squard Line @Durgesh4993</p>
<p></p>
</footer>
</div>
</footer>
</div>

<div id="overlay"></div>

<script src="game.js"></script>
<div id="dialogBox">
<h2>Welcome to the Squared Game</h2>
<button onclick="closeDialog()">LET'S PLAY!</button>
</div>

<div id="myModal" class="modal">
<div class="modal-content">
<p id="modalMessage"></p>
<div class="close">RESTART</div>

</div>
</div>

<script src="game.js"></script>
<script>

</script>
</body>
</html>

</html>

0 comments on commit efd7e2b

Please sign in to comment.