-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pacman static files evam levels added.
- Loading branch information
1 parent
c49c0ea
commit e2913f9
Showing
6 changed files
with
122 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,3 @@ | ||
# All-in-One | ||
|
||
A collection of random but not so random JS/React projects! | ||
|
||
## JS | ||
|
||
### Weather App | ||
|
||
https://github.com/Bhardwaj-Himanshu/All-in-One/assets/74407676/9e7a1c75-20c1-4be7-bd38-65f02b65aca0 | ||
|
||
### Image Search App | ||
|
||
https://github.com/Bhardwaj-Himanshu/All-in-One/assets/74407676/3abce459-b0cc-424f-aba4-b5bdc2b5ff5b | ||
|
||
## React | ||
|
||
### Travel Landing Page | ||
|
||
https://github.com/Bhardwaj-Himanshu/All-in-One/assets/74407676/eec376fc-aba9-4773-b31e-38923eaf436b | ||
|
||
### Random Password Generator | ||
|
||
https://github.com/Bhardwaj-Himanshu/All-in-One/assets/74407676/9ffa63c0-8a99-4786-bbaa-c805ddfda3d8 | ||
|
||
### Currency Convertor | ||
|
||
https://github.com/Bhardwaj-Himanshu/All-in-One/assets/74407676/acf63b41-60ef-421c-874a-01760f07b6bb | ||
|
||
### Curent Checklist | ||
|
||
- [ ] Align the styles of all the mini projects inside this to match the home page style! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
body { | ||
padding-top: 8rem; | ||
} | ||
|
||
#container { | ||
display: flex; | ||
flex-direction: column; | ||
row-gap: 1rem; | ||
align-items: center; | ||
} | ||
|
||
#board { | ||
width: 320px; | ||
height: 320px; | ||
border: 5px solid black; | ||
display: grid; | ||
grid-template-rows: repeat(10, 1fr); | ||
grid-template-columns: repeat(10, 1fr); | ||
} | ||
|
||
.grid { | ||
border: 1px solid blue; | ||
} | ||
|
||
.wall { | ||
background-color: brown; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="icon" href="../static/p_logo.svg" /> | ||
<link rel="stylesheet" href="./pacman.css" /> | ||
<title>Pacman</title> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
<div id="level-buttons"> | ||
<button class="level-button">Level 1</button> | ||
<button class="level-button">Level 2</button> | ||
<button class="level-button">Level 3</button> | ||
</div> | ||
<div id="board"></div> | ||
</div> | ||
<script src="./pacman.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const board = document.getElementById('board'); | ||
const levelButtons = document.querySelectorAll('.level-button'); | ||
|
||
const levelOne = [ | ||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, | ||
1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, | ||
0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, | ||
0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
]; | ||
|
||
const levelTwo = [ | ||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, | ||
1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, | ||
1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, | ||
0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
]; | ||
|
||
const levelThree = [ | ||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, | ||
0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, | ||
1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, | ||
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
]; | ||
|
||
function levelDrawer(levelName = levelOne) { | ||
board.innerHTML = ''; | ||
for (let i = 0; i < 100; i++) { | ||
const element = document.createElement('div'); | ||
element.classList.add('grid'); | ||
element.setAttribute('id', i); | ||
if (levelName[i] == 1) { | ||
element.classList.add('wall'); | ||
} | ||
board.appendChild(element); | ||
} | ||
} | ||
|
||
levelDrawer(); | ||
|
||
levelButtons.forEach((element, elementIndex) => { | ||
element.addEventListener('click', () => { | ||
switch (elementIndex) { | ||
case 0: | ||
// console.log('level 1 should be started.'); | ||
levelDrawer(levelOne); | ||
break; | ||
case 1: | ||
// console.log('level 2 should be started.'); | ||
levelDrawer(levelTwo); | ||
break; | ||
case 2: | ||
// console.log('level 3 should be started.'); | ||
levelDrawer(levelThree); | ||
break; | ||
default: | ||
break; | ||
} | ||
}); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.