Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…sions into thirteen
  • Loading branch information
anisharma07 committed Jul 13, 2024
2 parents b718e8f + 34ef6b5 commit c141a09
Show file tree
Hide file tree
Showing 54 changed files with 63,226 additions and 1 deletion.
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);
}
Binary file added Falling Skies Game/background.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Falling Skies Game/deer_left.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Falling Skies Game/deer_right.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
168 changes: 168 additions & 0 deletions Falling Skies Game/falling_skies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Falling Skies by Mahesh Sawant

import turtle
import os
import random
import time

# Set up the screen
wn = turtle.Screen()
wn.title("Falling Skies by Mahesh Sawant")
wn.bgcolor("black")
wn.bgpic("background.gif")
wn.setup(width=800, height=600)
wn.tracer(0)

wn.register_shape("deer_left.gif")
wn.register_shape("deer_right.gif")
wn.register_shape("hunter.gif")
wn.register_shape("nut.gif")

# Score
score = 0

# Health
lives = 3

# Player
player = turtle.Turtle()
player.speed(0)
player.shape("deer_left.gif")
player.color("white")
player.penup()
player.goto(0, -250)
player.direction = "stop"

# Good things
good_things = []

for _ in range(20):
good_thing = turtle.Turtle()
good_thing.speed(0)
good_thing.shape("nut.gif")
good_thing.color("green")
good_thing.penup()
good_thing.goto(-100, 250)
good_thing.speed = random.randint(1, 2)

good_things.append(good_thing)

# Bad things
bad_things = []

for _ in range(20):
bad_thing = turtle.Turtle()
bad_thing.speed(0)
bad_thing.shape("hunter.gif")
bad_thing.color("red")
bad_thing.penup()
bad_thing.goto(100, 250)
bad_thing.speed = random.randint(1, 2)

bad_things.append(bad_thing)

# Pen
pen = turtle.Turtle()
pen.speed(0)
pen.shape("square")
pen.color("white")
pen.penup()
pen.hideturtle()
pen.goto(0, 260)
pen.write("Score: 0 Lives: 3", align="center", font=("Courier", 24, "normal"))

# Functions
def go_left():
player.direction = "left"
player.shape("deer_left.gif")

def go_right():
player.direction = "right"
player.shape("deer_right.gif")


# Keyboard bindings
wn.listen()
wn.onkeypress(go_left, "Left")
wn.onkeypress(go_right, "Right")

# Main game loop
while True:
wn.update()

# Move the player
if player.direction == "left":
player.setx(player.xcor() - 1)

if player.direction == "right":
player.setx(player.xcor() + 1)

# Check for border collisions
if player.xcor() < -390:
player.setx(-390)

elif player.xcor() > 390:
player.setx(390)

for good_thing in good_things:
# Move the good things
good_thing.sety(good_thing.ycor() - good_thing.speed)

# Check if good things are off the screen
if good_thing.ycor() < -300:
good_thing.goto(random.randint(-300, 300), random.randint(400, 800))

# Check for collisions
if player.distance(good_thing) < 40:
# Score increases
score += 10

# Show the score
pen.clear()
pen.write("Score: {} Lives: {}".format(score, lives), align="center", font=("Courier", 24, "normal"))

# Move the good thing back to the top
good_thing.goto(random.randint(-300, 300), random.randint(400, 800))



for bad_thing in bad_things:
# Move the bad things
bad_thing.sety(bad_thing.ycor() - bad_thing.speed)

if bad_thing.ycor() < -300:
bad_thing.goto(random.randint(-300, 300), random.randint(400, 800))


if player.distance(bad_thing) < 40:
# Score increases
score -= 10
lives -= 1

# Show the score
pen.clear()
pen.write("Score: {} Lives: {}".format(score, lives), align="center", font=("Courier", 24, "normal"))

time.sleep(1)
# Move the bad things back to the top
for bad_thing in bad_things:
bad_thing.goto(random.randint(-300, 300), random.randint(400, 800))


# Check for game over
if lives == 0:
pen.clear()
pen.write("Game Over! Score: {}".format(score), align="center", font=("Courier", 24, "normal"))
wn.update()
time.sleep(5)
score = 0
lives = 3
pen.clear()
pen.write("Score: {} Lives: {}".format(score, lives), align="center", font=("Courier", 24, "normal"))







Binary file added Falling Skies Game/hunter.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions Falling Skies Game/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Falling Skies",
"version": "1.0.0",
"description": "A fun game where the player controls a deer to collect nuts and avoid hunters.",
"author": "Mahesh Sawant",
"main": "falling_skies.py",
"dependencies": {
"turtle": "included"
},
"scripts": {
"start": "python falling_skies.py"
},
"assets": {
"images": [
"background.gif",
"deer_left.gif",
"deer_right.gif",
"hunter.gif",
"nut.gif"
]
}
}

Binary file added Falling Skies Game/nut.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c141a09

Please sign in to comment.