Skip to content

Commit 34ef6b5

Browse files
Merge pull request #2352 from taneeshaa15/master
3D Maze
2 parents e0f66ae + 6ce39b7 commit 34ef6b5

File tree

5 files changed

+128
-0
lines changed

5 files changed

+128
-0
lines changed

3D Maze/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# **3D Maze Chrome Extension**
2+
3+
---
4+
5+
<br>
6+
7+
# **Description 📃**
8+
<!-- add your game description here -->
9+
- The 3D Maze Chrome extension is an interactive game that brings a 3D maze to your browser. Navigate through the maze using your keyboard and enjoy a fun break from your daily tasks.
10+
11+
# **Functionalities 🎮**
12+
<!-- add functionalities over here -->
13+
- Interactive 3D maze game playable directly within the extension.
14+
- Use arrow keys to navigate through the maze.
15+
- Simple and intuitive controls for an enjoyable gaming experience.
16+
- User-friendly interface with a clean and intuitive design.
17+
<br>
18+
19+
20+
# **How to Use? 🕹️**
21+
<!-- add the steps how to use extension -->
22+
- Install the 3D Maze Chrome extension from the Chrome Web Store.
23+
- Click on the extension icon to open the game.
24+
- Use the arrow keys on your keyboard to move through the maze.
25+
- Navigate through the maze to find the exit and complete the game.
26+
- Enjoy the game and take a fun break whenever you need it.
27+
28+
<br>

3D Maze/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>3D Maze Game</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div id="maze"></div>
11+
<script src="script.js"></script>
12+
</body>
13+
</html>

3D Maze/manifest.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"manifest_version": 3,
3+
"name": "3D Maze Game",
4+
"version": "1.0",
5+
"description": "A simple 3D maze game.",
6+
"permissions": [],
7+
"action": {
8+
"default_popup": "index.html",
9+
"default_icon": {
10+
"16": "icon.png",
11+
"48": "icon.png",
12+
"128": "icon.png"
13+
}
14+
}
15+
}
16+

3D Maze/script.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
document.addEventListener('DOMContentLoaded', () => {
2+
const mazeElement = document.getElementById('maze');
3+
4+
const walls = [
5+
{ x: 0, y: 0 },
6+
{ x: 100, y: 0 },
7+
{ x: 200, y: 0 },
8+
// Add more walls here
9+
];
10+
11+
walls.forEach(wall => {
12+
const wallElement = document.createElement('div');
13+
wallElement.className = 'wall';
14+
wallElement.style.transform = `translateX(${wall.x}px) translateY(${wall.y}px)`;
15+
mazeElement.appendChild(wallElement);
16+
});
17+
18+
const playerElement = document.createElement('div');
19+
playerElement.className = 'player';
20+
mazeElement.appendChild(playerElement);
21+
22+
let playerPosition = { x: 0, y: 0 };
23+
24+
document.addEventListener('keydown', (e) => {
25+
switch (e.key) {
26+
case 'ArrowUp':
27+
playerPosition.y -= 10;
28+
break;
29+
case 'ArrowDown':
30+
playerPosition.y += 10;
31+
break;
32+
case 'ArrowLeft':
33+
playerPosition.x -= 10;
34+
break;
35+
case 'ArrowRight':
36+
playerPosition.x += 10;
37+
break;
38+
}
39+
playerElement.style.transform = `translateX(${playerPosition.x}px) translateY(${playerPosition.y}px) translateZ(50px)`;
40+
});
41+
});

3D Maze/style.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
body, html {
2+
margin: 0;
3+
padding: 0;
4+
width: 100%;
5+
height: 100%;
6+
overflow: hidden;
7+
}
8+
9+
#maze {
10+
width: 100%;
11+
height: 100%;
12+
position: relative;
13+
perspective: 1000px;
14+
}
15+
16+
.wall {
17+
position: absolute;
18+
width: 100px;
19+
height: 100px;
20+
background-color: #333;
21+
transform-style: preserve-3d;
22+
}
23+
24+
.player {
25+
position: absolute;
26+
width: 50px;
27+
height: 50px;
28+
background-color: red;
29+
transform: translateZ(50px);
30+
}

0 commit comments

Comments
 (0)