forked from kunjgit/GameZone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In this game there are several stickers given in various pieces. The pieces can be shuffled to form a meaningful sticker.
- Loading branch information
Showing
33 changed files
with
220 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# **Stick the Sticker!** | ||
|
||
--- | ||
|
||
<br> | ||
|
||
## **Description 📃** | ||
|
||
This is a fun game to stick the puzzle pieces of the sticker together. You have to use the shuffle button to shuffle the sticker pieces until it makes an object. While playing you will see many patterns in which the puzzle pieces can be arranged. There are several puzzles to enjoy. | ||
|
||
## **Functionalities 🎮** | ||
- The puzzles are in the form of the stickers. | ||
- The shuffle button shuffles the pieces. | ||
- The arrow button open different puzzles. | ||
|
||
## **How to play? 🕹️** | ||
- Click on the shuffle button to shuffle the puzzle pieces. | ||
- Stop clicking the button, when the sticker takes a form. | ||
- Use the side arrows to play various puzzles. | ||
<br> | ||
|
||
## **Screenshots 📸** | ||
|
||
<br> | ||
<b>Game Page</b> | ||
<img src = "assets/1.png"> | ||
<img src = "assets/2.png"> | ||
|
||
<br> | ||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Puzzle Game</title> | ||
<link rel="stylesheet" type="text/css" href="style.css"> | ||
</head> | ||
<body> | ||
<button class="button1" id="btn1"><</button> | ||
<div class="container"> | ||
|
||
<h1 class="title">Stick The Sticker</h1> | ||
<div id="puzzle-container"></div> | ||
<div class="button"><button id="shuffle-btn">Shuffle</button></div> | ||
|
||
|
||
</div> | ||
<button class="button2" id="btn2">></button> | ||
|
||
|
||
<script src="script.js"></script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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,101 @@ | ||
// Puzzle data | ||
var puzzles = [ | ||
{ | ||
folderPath: 'puzzle1', | ||
pieces: ['p12.png', 'p11.png', 'p13.png', 'p14.png'] | ||
}, | ||
{ | ||
folderPath: 'puzzle2', | ||
pieces: ['p21.png', 'p22.png', 'p23.png', 'p24.png'] | ||
}, | ||
{ | ||
folderPath: 'puzzle3', | ||
pieces: ['p31.png', 'p32.png', 'p33.png', 'p34.png'] | ||
}, | ||
{ | ||
folderPath: 'puzzle4', | ||
pieces: ['p41.png', 'p42.png', 'p43.png', 'p44.png'] | ||
}, | ||
{ | ||
folderPath: 'puzzle5', | ||
pieces: ['p51.png', 'p52.png', 'p53.png', 'p54.png'] | ||
}, | ||
{ | ||
folderPath: 'puzzle6', | ||
pieces: ['p61.png', 'p62.png', 'p63.png', 'p64.png'] | ||
}, | ||
|
||
// Add more puzzles as needed... | ||
]; | ||
|
||
// Set the number of turns before resetting positions | ||
var turnsBeforeReset = 4; | ||
var currentTurn = 0; | ||
|
||
// Get puzzle container element | ||
var puzzleContainer = document.getElementById('puzzle-container'); | ||
|
||
// Current puzzle index | ||
var currentPuzzleIndex = 0; | ||
|
||
// Initialize the puzzle game | ||
createPuzzleGame(puzzles[currentPuzzleIndex]); | ||
|
||
// Handle shuffle button click | ||
var shuffleBtn = document.getElementById('shuffle-btn'); | ||
shuffleBtn.addEventListener('click', function () { | ||
createPuzzleGame(puzzles[currentPuzzleIndex]); | ||
}); | ||
|
||
// Handle button1 click | ||
var button1 = document.getElementById('btn1'); | ||
button1.addEventListener('click', function () { | ||
currentPuzzleIndex--; | ||
if (currentPuzzleIndex < 0) { | ||
currentPuzzleIndex = puzzles.length - 1; | ||
} | ||
createPuzzleGame(puzzles[currentPuzzleIndex]); | ||
}); | ||
|
||
// Handle button2 click | ||
var button2 = document.getElementById('btn2'); | ||
button2.addEventListener('click', function () { | ||
currentPuzzleIndex++; | ||
if (currentPuzzleIndex >= puzzles.length) { | ||
currentPuzzleIndex = 0; | ||
} | ||
createPuzzleGame(puzzles[currentPuzzleIndex]); | ||
}); | ||
|
||
// Create the puzzle game | ||
function createPuzzleGame(puzzle) { | ||
puzzleContainer.innerHTML = ''; | ||
|
||
// Shuffle the puzzle pieces | ||
var shuffledPieces = shuffleArray(puzzle.pieces); | ||
|
||
// Create puzzle piece stickers | ||
for (var i = 0; i < shuffledPieces.length; i++) { | ||
var piece = document.createElement('div'); | ||
piece.classList.add('puzzle-piece'); | ||
piece.style.backgroundImage = `url('${puzzle.folderPath}/${shuffledPieces[i]}')`; | ||
puzzleContainer.appendChild(piece); | ||
} | ||
} | ||
|
||
// Shuffle the puzzle pieces randomly or reset positions | ||
function shuffleArray(array) { | ||
if (currentTurn >= turnsBeforeReset) { | ||
currentTurn = 0; | ||
return array; // Return the original array order | ||
} else { | ||
currentTurn++; | ||
for (var i = array.length - 1; i > 0; i--) { | ||
var j = Math.floor(Math.random() * (i + 1)); | ||
var temp = array[i]; | ||
array[i] = array[j]; | ||
array[j] = temp; | ||
} | ||
return array; | ||
} | ||
} |
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,64 @@ | ||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
background-color: #8a5bcc; | ||
} | ||
|
||
.title{ | ||
height: fit-content; | ||
justify-content: center; | ||
margin-left: 4rem; | ||
font-family: Georgia, 'Times New Roman', Times, serif; | ||
font-size: 40px; | ||
} | ||
|
||
#puzzle-container { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
grid-template-rows: repeat(2, 1fr); | ||
gap: 10px; | ||
width: 500px; | ||
height: 500px; | ||
/* border: 2px solid #ccc; */ | ||
padding: 10px; | ||
background-color: #8a5bcc; | ||
position: relative; | ||
} | ||
|
||
.puzzle-piece { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: #8a5bcc; | ||
/* font-size: 24px; */ | ||
font-weight: bold; | ||
} | ||
|
||
#shuffle-btn { | ||
background-color: #000000; | ||
color: #fff; | ||
border: none; | ||
padding: 10px 20px; | ||
font-size: 25px; | ||
font-weight: bold; | ||
position: absolute; | ||
bottom: 10px; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
} | ||
|
||
.button{ | ||
margin: 2rem; | ||
} | ||
|
||
.button1, .button2{ | ||
margin-left: 0%; | ||
background: inherit; | ||
font-size: 7rem; | ||
border: none; | ||
padding: 2rem; | ||
} | ||
|
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
Oops, something went wrong.
Binary file not shown.