Skip to content

Commit

Permalink
Merge pull request #4949 from vivekvardhan2810/main
Browse files Browse the repository at this point in the history
[New game]: Circuit Craze
  • Loading branch information
kunjgit authored Jul 28, 2024
2 parents c40ca2d + 3870e32 commit 4834de7
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 1 deletion.
27 changes: 27 additions & 0 deletions Games/Circuit_Craze/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# *Game_Name*
Circuit Craze

---

<br>

## *Description 📃*
Circuit Craze is a puzzle game where players build and complete electrical circuits to power different machines and gadgets. Each level introduces more complex circuit components.

## *Functionalities 🎮*

1. Click the "Start Game" button to begin.
2. Build and complete electrical circuits to power machines and gadgets.
3. Monitor the score, progress, and level.
4. When all circuits are completed, the game advances to the next level with new components.

1. Controls: Use the mouse to connect circuit components and the keyboard to toggle switches.
2. Scoring: Completing a circuit increases your score by 50 points.
3. Difficulty: Each level introduces more complex components and wiring challenges.
4. Timer: Each level has a 2-minute time limit.
5. Game Over: When the timer runs out or a circuit is not completed correctly, the final score is displayed with an option to play again.

<br>

## *Screenshots 📸*
![Screenshot 2024-07-23 231219](https://github.com/user-attachments/assets/32eca0da-2806-4ca6-9fcd-5ec7e893ace4)
23 changes: 23 additions & 0 deletions Games/Circuit_Craze/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Circuit Craze</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="overlay">
<div class="container">
<h1>Circuit Craze</h1>
<div id="game-board">
<!-- Game board will be populated dynamically -->
</div>
<div id="controls">
<button id="reset-btn">Reset</button>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
66 changes: 66 additions & 0 deletions Games/Circuit_Craze/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
document.addEventListener('DOMContentLoaded', () => {
const gameBoard = document.getElementById('game-board');
const boardSize = 5;
let board = [];

function createBoard() {
gameBoard.innerHTML = ''; // Clear the game board before creating it
board = [];
for (let i = 0; i < boardSize; i++) {
let row = [];
for (let j = 0; j < boardSize; j++) {
let cell = document.createElement('div');
cell.classList.add('cell');
cell.dataset.row = i;
cell.dataset.col = j;
cell.addEventListener('click', () => toggleCell(cell));
gameBoard.appendChild(cell);
row.push(cell);
}
board.push(row);
}
}

function toggleCell(cell) {
let row = parseInt(cell.dataset.row);
let col = parseInt(cell.dataset.col);

toggleSingleCell(row, col);
toggleSingleCell(row - 1, col); // Top
toggleSingleCell(row + 1, col); // Bottom
toggleSingleCell(row, col - 1); // Left
toggleSingleCell(row, col + 1); // Right

checkWin();
}

function toggleSingleCell(row, col) {
if (row >= 0 && row < boardSize && col >= 0 && col < boardSize) {
let cell = board[row][col];
cell.classList.toggle('active');
}
}

function checkWin() {
let allActive = true;
for (let i = 0; i < boardSize; i++) {
for (let j = 0; j < boardSize; j++) {
if (!board[i][j].classList.contains('active')) {
allActive = false;
break;
}
}
if (!allActive) break;
}
if (allActive) {
alert('You completed the circuit! You win!');
}
}

function resetGame() {
board.forEach(row => row.forEach(cell => cell.classList.remove('active')));
}

createBoard();
document.getElementById('controls').querySelector('button').addEventListener('click', resetGame);
});
100 changes: 100 additions & 0 deletions Games/Circuit_Craze/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
body {
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #1e1e1e 0%, #111 100%);
overflow: hidden;
}

.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
justify-content: center;
align-items: center;
}

.container {
text-align: center;
background: rgba(0, 0, 0, 0.9);
padding: 20px;
border-radius: 15px;
box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
width: 90%;
max-width: 500px;
animation: fadeIn 1.5s ease-in-out;
}

h1 {
font-size: 2.5em;
color: #0f0; /* Neon green */
margin-bottom: 20px;
text-shadow: 0 0 10px #0f0;
animation: fadeIn 1.5s ease-in-out;
}

#game-board {
display: grid;
grid-template-columns: repeat(5, 60px);
grid-template-rows: repeat(5, 60px);
gap: 10px;
margin: 20px auto;
justify-content: center;
animation: fadeIn 1.5s ease-in-out;
}

.cell {
width: 60px;
height: 60px;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
background-color: #222;
border: 2px solid #0f0;
transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
box-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
}

.cell:hover {
transform: scale(1.1);
}

.cell.active {
background-color: #0f0; /* Neon green */
color: #222;
box-shadow: 0 0 20px rgba(0, 255, 0, 1);
}

#controls {
margin-top: 20px;
animation: fadeIn 1.5s ease-in-out;
}

button {
background-color: #0f0; /* Neon green */
color: #222;
border: none;
padding: 10px 20px;
font-size: 1em;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}

button:hover {
background-color: #0d0;
transform: scale(1.1);
box-shadow: 0 0 20px rgba(0, 255, 0, 1);
}

@keyframes fadeIn {
from { opacity: 0; transform: translateY(-10px); }
to { opacity: 1; transform: translateY(0); }
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,12 @@ This repository also provides one such platforms where contributers come over an
| [Ultimate_Football_Manager](https://github.com/kunjgit/GameZone/tree/main/Games/Ultimate_Football_Manager) | [Zombie_Shooter](https://github.com/kunjgit/GameZone/tree/main/Games/Zombie_Shooter)| [Ganesh_QR_Maker](https://github.com/kunjgit/GameZone/tree/main/Games/Ganesh_QR_Maker) | [Brain_Card_game](https://github.com/Kunjgit/GameZone/tree/main/Games/Brain_Card_game)| [Wheel_of_Fortunes](https://github.com/kunjgit/GameZone/tree/main/Games/Wheel_of_Fortunes)|
|[Samurai_Fighting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Samurai_Fighting_Game)| [Tic-tac-toe](https://github.com/kunjgit/GameZone/tree/main/Games/Tic-tac-toe)| [Quest_For_Riches](https://github.com/kunjgit/GameZone/tree/main/Games/Quest_For_Riches)| [Pattern Creation Game](https://github.com/kunjgit/GameZone/tree/main/Games/Pattern_Creation_Game)| [Magic_8_ball_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Magic_8_ball) |
| [Catch_Craze](https://github.com/kunjgit/GameZone/tree/main/Games/Catch_Craze) | [UNO game with computer](https://github.com/kunjgit/GameZone/tree/main/Games/UNO_game_with_Computer) | [Dice_Rolling_Simulator](https://github.com/priyashuu/GameZone/tree/main/Games/Dice_rolling_simulator)| [Space_Dominators](https://github.com/kunjgit/GameZone/tree/main/Games/Space_Dominators)| [Simon_Says](https://github.com/kunjgit/GameZone/tree/main/Games/Simon_Says) |

|[Idle_miner](https://github.com/kunjgit/GameZone/tree/main/Games/Idle_miner)| [Five_Nights_at_Freddys](https://github.com/kunjgit/GameZone/tree/main/Games/Five_Nights_at_Freddys) | [Penalty_Shootout_Game] (https://github.com/kunjgit/GameZone/tree/main/Games/Penalty_Shootout_Game)| | [Circuit_Craze](https://github.com/kunjgit/GameZone/tree/main/Games/Circuit_Craze) |

|[Idle_miner](https://github.com/kunjgit/GameZone/tree/main/Games/Idle_miner)| [Five_Nights_at_Freddys](https://github.com/kunjgit/GameZone/tree/main/Games/Five_Nights_at_Freddys) | [Penalty_Shootout_Game] (https://github.com/kunjgit/GameZone/tree/main/Games/Penalty_Shootout_Game)| |[Snake_Gun_Water](https://github.com/kunjgit/GameZone/tree/main/Games/Snake_Gun_Water)|
| [Drum_kit] (https://github.com/kunjgit/GameZone/tree/main/Games/Drum_kit)|
|[Balloon_Popup] (https://github.com/kunjgit/GameZone/tree/main/Games/Balloon_Popup)|
</center>
<br>
<p align="right"><a href="#top">Back to top</a></p>
Expand Down
Binary file added assets/images/Circuit_Craze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4834de7

Please sign in to comment.