Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D Maze #2352

Merged
merged 2 commits into from
Jul 12, 2024
Merged

3D Maze #2352

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
Loading