Skip to content

Commit

Permalink
Merge pull request #2352 from taneeshaa15/master
Browse files Browse the repository at this point in the history
3D Maze
  • Loading branch information
Sulagna-Dutta-Roy authored Jul 12, 2024
2 parents e0f66ae + 6ce39b7 commit 34ef6b5
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 0 deletions.
28 changes: 28 additions & 0 deletions 3D Maze/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# **3D Maze Chrome Extension**

---

<br>

# **Description 📃**
<!-- add your game description here -->
- 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.

# **Functionalities 🎮**
<!-- add functionalities over here -->
- Interactive 3D maze game playable directly within the extension.
- Use arrow keys to navigate through the maze.
- Simple and intuitive controls for an enjoyable gaming experience.
- User-friendly interface with a clean and intuitive design.
<br>


# **How to Use? 🕹️**
<!-- add the steps how to use extension -->
- Install the 3D Maze Chrome extension from the Chrome Web Store.
- Click on the extension icon to open the game.
- Use the arrow keys on your keyboard to move through the maze.
- Navigate through the maze to find the exit and complete the game.
- Enjoy the game and take a fun break whenever you need it.

<br>
13 changes: 13 additions & 0 deletions 3D Maze/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D Maze Game</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="maze"></div>
<script src="script.js"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions 3D Maze/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"manifest_version": 3,
"name": "3D Maze Game",
"version": "1.0",
"description": "A simple 3D maze game.",
"permissions": [],
"action": {
"default_popup": "index.html",
"default_icon": {
"16": "icon.png",
"48": "icon.png",
"128": "icon.png"
}
}
}

41 changes: 41 additions & 0 deletions 3D Maze/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
document.addEventListener('DOMContentLoaded', () => {
const mazeElement = document.getElementById('maze');

const walls = [
{ x: 0, y: 0 },
{ x: 100, y: 0 },
{ x: 200, y: 0 },
// Add more walls here
];

walls.forEach(wall => {
const wallElement = document.createElement('div');
wallElement.className = 'wall';
wallElement.style.transform = `translateX(${wall.x}px) translateY(${wall.y}px)`;
mazeElement.appendChild(wallElement);
});

const playerElement = document.createElement('div');
playerElement.className = 'player';
mazeElement.appendChild(playerElement);

let playerPosition = { x: 0, y: 0 };

document.addEventListener('keydown', (e) => {
switch (e.key) {
case 'ArrowUp':
playerPosition.y -= 10;
break;
case 'ArrowDown':
playerPosition.y += 10;
break;
case 'ArrowLeft':
playerPosition.x -= 10;
break;
case 'ArrowRight':
playerPosition.x += 10;
break;
}
playerElement.style.transform = `translateX(${playerPosition.x}px) translateY(${playerPosition.y}px) translateZ(50px)`;
});
});
30 changes: 30 additions & 0 deletions 3D Maze/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
}

#maze {
width: 100%;
height: 100%;
position: relative;
perspective: 1000px;
}

.wall {
position: absolute;
width: 100px;
height: 100px;
background-color: #333;
transform-style: preserve-3d;
}

.player {
position: absolute;
width: 50px;
height: 50px;
background-color: red;
transform: translateZ(50px);
}

0 comments on commit 34ef6b5

Please sign in to comment.