Skip to content

Commit

Permalink
Merge branch 'main' into city890
Browse files Browse the repository at this point in the history
  • Loading branch information
pallasivasai authored Jul 2, 2024
2 parents 8f1643e + 6b4aa69 commit 0fb0105
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 8 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,12 @@ ________________________________________________________________________________
| 191 | [Doraemon Run](.SinglePlayer%20-%20Games/DoraemonRun) |
| 192 | [Hand_Cricket_Champ](./SinglePlayer%20-%20Games/Hand_Cricket_Champ) |
| 193 | [SnakeBites Game](./SinglePlayer%20-%20Games/SnakeBites) |
| 194 | [Earth_Guardian](./SinglePlayer%20-%20Games/Earth_Guardian) |
| 195 | [Hand_Cricket_Champ](./SinglePlayer%20-%20Games/Hand_Cricket_Champ) |
| 196 | [SnakeBites Game](./SinglePlayer%20-%20Games/SnakeBites) |
| 197 | [Flames_Game](../MultiPlayer%20-%20Games/Flames_Game) |
| 198 | [Ball_Fall_Game](.SinglePlayer%20-%20Games/Ball_Fall_Game) |
| 199 | [City_Builder_Game](.SinglePlayer%20-%20Games/City_Builder_Game) |


| 194 | [Pop My Balloon](<MultiPlayer - Games/Pop_My_Balloon>) |
| 196 | [Doraemon Run](.SinglePlayer%20-%20Games/DoraemonRun) |
| 197 | [Earth_Guardian](./SinglePlayer%20-%20Games/Earth_Guardian) |
| 198 | [Flames_Game](../MultiPlayer%20-%20Games/Flames_Game) |
| 199 | [Ball_Fall_Game](.SinglePlayer%20-%20Games/Ball_Fall_Game) |
| 200 | [City_Builder_Game](.SinglePlayer%20-%20Games/City_Builder_Game) |



Expand Down
16 changes: 16 additions & 0 deletions SinglePlayer - Games/Quantum_Maze/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quantum Maze</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Quantum Maze</h1>
<div id="game-container">
<canvas id="gameCanvas"></canvas>
</div>
<script src="script.js"></script>
</body>
</html>
82 changes: 82 additions & 0 deletions SinglePlayer - Games/Quantum_Maze/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
canvas.width = 600;
canvas.height = 600;


const gridSize = 20;
const mazeSize = canvas.width / gridSize;
const player = {
x: 0,
y: 0,
color: 'yellow'
};


const quantumWalls = [];
const entangledPaths = [];


for (let i = 0; i < mazeSize; i++) {
quantumWalls[i] = [];
for (let j = 0; j < mazeSize; j++) {
quantumWalls[i][j] = Math.random() > 0.7 ? 'wall' : 'empty';
}
}


function drawMaze() {
for (let i = 0; i < mazeSize; i++) {
for (let j = 0; j < mazeSize; j++) {
if (quantumWalls[i][j] === 'wall') {
ctx.fillStyle = 'grey';
ctx.fillRect(i * gridSize, j * gridSize, gridSize, gridSize);
}
}
}
}


function drawPlayer() {
ctx.fillStyle = player.color;
ctx.fillRect(player.x * gridSize, player.y * gridSize, gridSize, gridSize);
}


function movePlayer(x, y) {
if (x >= 0 && x < mazeSize && y >= 0 && y < mazeSize) {
if (quantumWalls[x][y] !== 'wall') {
player.x = x;
player.y = y;
collapseWalls(x, y);
}
}
}


function collapseWalls(x, y) {
if (Math.random() > 0.5) {
quantumWalls[x][y] = 'empty';
} else {
quantumWalls[x][y] = 'wall';
}
}


document.addEventListener('keydown', (event) => {
if (event.key === 'ArrowUp') movePlayer(player.x, player.y - 1);
if (event.key === 'ArrowDown') movePlayer(player.x, player.y + 1);
if (event.key === 'ArrowLeft') movePlayer(player.x - 1, player.y);
if (event.key === 'ArrowRight') movePlayer(player.x + 1, player.y);
updateGame();
});


function updateGame() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
drawMaze();
drawPlayer();
}


updateGame();
25 changes: 25 additions & 0 deletions SinglePlayer - Games/Quantum_Maze/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
background-color: #000;
color: #fff;
margin: 0;
font-family: Arial, sans-serif;
}


#game-container {
position: relative;
width: 600px;
height: 600px;
background-color: #333;
}


canvas {
border: 2px solid #fff;
background-color: #222;
}
2 changes: 2 additions & 0 deletions additionalpage/game.html
Original file line number Diff line number Diff line change
Expand Up @@ -7501,6 +7501,7 @@ <h4 class = "text-white uppercase game-card-title">Ball_Fall_Game</h4>




<!--Card start-->
<div class = "game-card">
<div class = "game-card-top img-fit-cover">
Expand Down Expand Up @@ -7557,6 +7558,7 @@ <h4 class = "text-white uppercase game-card-title">City_Builder_Game</h4>




<!--Card start-->
<div class="game-card">
<div class="game-card-top img-fit-cover">
Expand Down

0 comments on commit 0fb0105

Please sign in to comment.