Skip to content

Commit

Permalink
feat: add final game assets, sounds, and documentation
Browse files Browse the repository at this point in the history
- Implemented game functionalities: two levels, player controls, enemy AI, puzzles, and scoring system.
- Integrated sound effects for various game actions.
- Added health, coin count, and key indicators.
- Included NPC interactions with dialogue and chat sound.
- Enhanced game UI with animations and modal for puzzles.
- Updated README.md with game description, functionalities, and how to play instructions.
- Included all necessary assets: sprites, backgrounds, and audio files.
- Fixed bugs and cleaned up the code for readability and performance.
  • Loading branch information
peculiap1 committed Jun 16, 2024
1 parent 46d92df commit b9fbbb8
Show file tree
Hide file tree
Showing 15 changed files with 379 additions and 271 deletions.
40 changes: 15 additions & 25 deletions Games/Quest_For_Riches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,32 @@

---

<br>

## **Description 📃**

Quest for Riches is an adventure game where players navigate through various levels to find hidden treasures. Each level presents unique challenges, puzzles, and enemies that the player must overcome to progress. The game is designed to be engaging and fun, with increasing difficulty as the player advances through the levels.
Quest for Riches is a side-scrolling action-adventure game where players navigate through a fantasy world, battling enemies and solving puzzles to find hidden treasure. The game includes a health system, enemy AI, player combat mechanics, and level progression. The game is designed to be engaging and fun, with increasing difficulty as the player advances through the levels.

## **Functionalities 🎮**

- Multiple levels with unique themes (e.g., jungle, cave, underwater)
- Player controls for moving left, right, and jumping
- Various obstacles like moving platforms and spikes
- Two levels
- Player controls for moving left, right, jumping, and attacking
- Simple enemy AI with predictable movement patterns
- Puzzles such as finding keys and matching patterns
- Puzzles such as finding keys and matching code patterns
- Scoring system based on treasures collected and level completion time
- Responsive design for both desktop and mobile browsers

<br>
- Simple design for desktop browsers

## **How to play? 🕹️**

1. Use the arrow keys or WASD keys to move the player character.
2. Navigate through the levels, avoiding obstacles and enemies.
3. Collect hidden treasures to increase your score.
4. Solve puzzles to unlock new areas and progress to the next level.
5. Reach the end of each level to advance to the next one.
6. Try to complete all levels with the highest score possible.

<br>
1. Use the **A** and **D** keys to move the player character left and right.
2. Use the **Spacebar** to jump.
3. Use **E** to interact.
4. **Left Mouse Click** to attack.
5. Navigate through the levels by speaking to NPCs and following missions.
6. Collect coins to increase your score.
7. Solve the code pattern to open the treasure.
8. Try to complete all levels with the highest score possible.

## **Screenshots 📸**

<!-- Add your screenshots like this -->
<!-- ![image](url) -->
![Quest For Riches](assets/images/Quest_For_Riches.png)

<br>

## **Working video 📹**

<!-- Add your working video over here -->
---
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 26 additions & 16 deletions Games/Quest_For_Riches/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Basic styles for the body */
body {
padding: 0;
font-family: Arial, sans-serif;
Expand All @@ -10,6 +11,7 @@ body {
background-color: black;
}

/* Styles for main and controls screen */
#mainScreen, #controlsScreen {
text-align: center;
color: white;
Expand All @@ -32,6 +34,7 @@ body {
height: 100vh;
}

/* Button styles */
button {
background: yellow;
border: none;
Expand All @@ -46,11 +49,12 @@ button:hover {
background: orange;
}

/* Class to hide elements */
.hidden {
display: none;
}

/* Existing styles */
/* Chat bubble styles */
.chatBubble {
position: absolute;
display: none;
Expand All @@ -66,6 +70,7 @@ button:hover {
word-wrap: break-word;
}

/* Prompt E styles */
.promptE {
position: absolute;
display: none;
Expand All @@ -78,6 +83,7 @@ button:hover {
font-size: 14px;
}

/* Shake animation for modal */
@keyframes shake {
0% { transform: translateX(0); }
25% { transform: translateX(-10px); }
Expand All @@ -90,21 +96,22 @@ button:hover {
animation: shake 0.5s;
}

/* Modal styles */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
display: none;
position: fixed;
z-index: 1;
padding-top: 100px;
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgba(0, 0, 0, 0.9); /* Black w/ opacity */
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
background-color: #000000; /* Black background */
background-color: #000000;
margin: auto;
padding: 20px;
border: 1px solid #888;
Expand All @@ -115,6 +122,7 @@ button:hover {
text-align: center;
}

/* Close button styles for modal */
.close {
color: white;
float: right;
Expand All @@ -129,12 +137,14 @@ button:hover {
cursor: pointer;
}

/* Puzzle instructions styles */
#puzzleInstructions {
font-size: 24px;
color: #ffcc00;
margin-bottom: 20px;
}

/* Puzzle input styles */
#puzzleInput {
width: 100%;
padding: 10px;
Expand All @@ -148,6 +158,7 @@ button:hover {
text-align: center;
}

/* Submit puzzle button styles */
#submitPuzzle {
background-color: #ffcc00;
color: black;
Expand All @@ -162,6 +173,7 @@ button:hover {
background-color: #ff9900;
}

/* Mission tracker styles */
#missionTracker {
position: absolute;
top: 10px;
Expand All @@ -177,6 +189,7 @@ button:hover {
text-align: center;
}

/* Transition screen styles */
#transitionScreen {
position: fixed;
top: 0;
Expand All @@ -190,10 +203,6 @@ button:hover {
z-index: 1000;
}

.hidden {
display: none;
}

.transitionContent {
background: black;
border: 1px solid white;
Expand Down Expand Up @@ -230,7 +239,7 @@ button:hover {
background: orange;
}

/* New styles for the end game screen */
/* End game screen styles */
#endGameScreen {
position: fixed;
top: 0;
Expand Down Expand Up @@ -280,6 +289,7 @@ button:hover {
background: orange;
}

/* Back to GameZone button styles */
.backToGameZone {
display: block;
width: 100%;
Expand All @@ -296,4 +306,4 @@ button:hover {
.backToGameZone a {
color: black;
text-decoration: none;
}
}
19 changes: 19 additions & 0 deletions Games/Quest_For_Riches/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<!-- Back to GameZone Link -->
<div class="backToGameZone">
<a href="https://kunjgit.github.io/GameZone/" class="backToGameZoneLink"
>Back to GameZone</a
>
</div>

<!-- Main Screen -->
<div id="mainScreen">
<h1>Quest for Riches</h1>
<button id="startButton">Start Game</button>
<button id="controlsButton">Controls</button>
</div>

<!-- Controls Screen -->
<div id="controlsScreen" class="hidden">
<h2>Controls</h2>
<p>Click Left Mouse Button to Attack</p>
Expand All @@ -25,10 +30,18 @@ <h2>Controls</h2>
<p>Press Space to jump</p>
<button id="backButton">Back</button>
</div>

<!-- Game Canvas -->
<canvas class="hidden"></canvas>

<!-- NPC Chat Bubble and Prompt -->
<div class="chatBubble"></div>
<div class="promptE">E</div>

<!-- Mission Tracker -->
<div id="missionTracker" class="hidden">Mission: Talk to The Archer</div>

<!-- Puzzle Modal -->
<div id="puzzleModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
Expand All @@ -37,6 +50,8 @@ <h2>Controls</h2>
<button id="submitPuzzle">Submit</button>
</div>
</div>

<!-- Transition Screen -->
<div id="transitionScreen" class="hidden">
<div class="transitionContent">
<span class="close" id="closeTransitionScreen">&times;</span>
Expand All @@ -48,6 +63,8 @@ <h1>Mission passed!</h1>
<button id="nextLevelButton">Next level</button>
</div>
</div>

<!-- End Game Screen -->
<div id="endGameScreen" class="hidden">
<div class="transitionContent">
<span class="close" id="closeEndGameScreen">&times;</span>
Expand All @@ -56,6 +73,8 @@ <h1>Congratulations!</h1>
<button id="replayGameButton">Play Again</button>
</div>
</div>

<!-- Scripts -->
<script src="js/levels.js"></script>
<script src="js/audioManager.js"></script>
<script src="js/player.js"></script>
Expand Down
9 changes: 8 additions & 1 deletion Games/Quest_For_Riches/js/audioManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,43 @@ class AudioManager {
this.sounds = {};
}

// Load a sound and store it in the sounds object
loadSound(name, src) {
const sound = new Audio(src);
this.sounds[name] = sound; // Corrected this line
this.sounds[name] = sound;
}

// Play a sound by name
playSound(name) {
if (this.sounds[name]) {
this.sounds[name].play();
}
}

// Stop a sound by name
stopSound(name) {
if (this.sounds[name]) {
this.sounds[name].pause();
this.sounds[name].currentTime = 0;
}
}

// Set the volume for a specific sound
setVolume(name, volume) {
if (this.sounds[name]) {
this.sounds[name].volume = volume;
}
}
}

// Instantiate AudioManager and load sounds
const audioManager = new AudioManager();
audioManager.loadSound("coin", "assets/sounds/coin.wav");
audioManager.loadSound("chat", "assets/sounds/chat.wav");
audioManager.loadSound("levelComplete", "assets/sounds/levelcomplete.wav");
audioManager.loadSound("menu", "assets/sounds/menu.wav");
audioManager.loadSound("treasure", "assets/sounds/treasure.wav");
audioManager.loadSound("background", "assets/sounds/backgroundmusic.mp3");

// Set initial volume for background music
audioManager.setVolume("background", 0.25);
Loading

0 comments on commit b9fbbb8

Please sign in to comment.