diff --git a/Games/Pac_Man_Game/CodeStandards.md b/Games/Pac_Man_Game/CodeStandards.md new file mode 100644 index 0000000000..b228671bab --- /dev/null +++ b/Games/Pac_Man_Game/CodeStandards.md @@ -0,0 +1,63 @@ +# Code Standards + +## 1. File Structure +- Keep HTML, CSS, and JavaScript in separate files. +- Use clear and descriptive names for files and folders. + +## 2. HTML +- Use meaningful HTML tags. +- Link CSS and JavaScript files in the `
` or at the end of the ``. +- Use meaningful `id` and `class` names. + +## 3. CSS +- Use consistent class names (e.g., `kebab-case`). +- Group related styles together. +- Use comments to separate sections. +- Use relative units (e.g., `em`, `rem`) for sizes. +- Use `z-index` sparingly. +- Use CSS animations for effects. + +## 4. JavaScript +- Use `const` and `let` instead of `var`. +- Use `const` for variables that don't change. +- Use `let` for variables that can change. +- Use clear names for variables and functions. +- Use camelCase for variables and functions. +- Use PascalCase for class names. +- Group related functions together. +- Add comments above and/or next to code to explain it. +- Use template literals for strings. +- Use event listeners for user interactions. +- Use `setInterval` and `setTimeout` for timed actions. +- Use `querySelector` and `querySelectorAll` to select elements. +- Use `classList` to add, remove, and toggle classes. +- Use `appendChild` and `removeChild` for DOM changes. +- Use `addEventListener` for events. + +### Example + +```javascript +// Use const for variables that do not change +const gameBoard = document.getElementById('gameBoard'); + +// Use let for variables that may change +let score = 0; + +// Use descriptive names for functions +const initializeGame = () => { + // Function logic here +}; + +// Use event listeners to handle user interactions +document.addEventListener('DOMContentLoaded', initializeGame); + +// Use template literals for string concatenation +const updateScore = (points) => { + score += points; + document.getElementById('scoreValue').textContent = `Score: ${score}`; +}; + +// Use arrow functions for anonymous functions +document.getElementById('startGameButton').addEventListener('click', () => { + // Start game logic here +}); \ No newline at end of file diff --git a/Games/Pac_Man_Game/Img/Screenshot.png b/Games/Pac_Man_Game/Img/Screenshot.png index 2fb1a59e20..e2a5d12e26 100644 Binary files a/Games/Pac_Man_Game/Img/Screenshot.png and b/Games/Pac_Man_Game/Img/Screenshot.png differ diff --git a/Games/Pac_Man_Game/README.md b/Games/Pac_Man_Game/README.md index 9a50d70455..5c4734bbcc 100644 --- a/Games/Pac_Man_Game/README.md +++ b/Games/Pac_Man_Game/README.md @@ -6,8 +6,10 @@ This is a classic Pac-Man game built using HTML, CSS, and JavaScript. The object ## Functionalities 🎮 - **Pac-Man Movement**: Use arrow keys to move Pac-Man up, down, left, or right. - **Pac-Dots**: Eat pac-dots to increase your score. +- **Power Pellets**: Eat power pellets to temporarily turn ghosts blue and make them vulnerable. - **Ghosts**: Avoid ghosts that move around the maze. If a ghost touches Pac-Man, a life is lost. -- **Lives**: The player starts with 2 lives. The game ends when all lives are lost. +- **Fruits**: Occasionally, fruits appear in the maze. Eat them to gain extra points. +- **Lives**: The player starts with 3 lives. The game ends when all lives are lost. - **Winning Condition**: Collect all pac-dots to win the game. - **Game Over**: The game ends when Pac-Man loses all lives and gets caught. @@ -19,9 +21,11 @@ This is a classic Pac-Man game built using HTML, CSS, and JavaScript. The object - **Arrow Left**: Move left - **Arrow Right**: Move right 3. **Collect Pac-Dots**: Navigate through the maze and collect all the pac-dots to increase your score. -4. **Avoid Ghosts**: Avoid the ghosts moving around the maze. If a ghost touches Pac-Man, a life is lost. -5. **Game Over**: The game ends when Pac-Man loses all lives. A message will display "Game over! You lost!". -6. **Win the Game**: Collect all pac-dots to win the game. A message will display "Congratulations! You won!". +4. **Eat Power Pellets**: Eat power pellets to turn ghosts blue and make them vulnerable. You can eat blue ghosts for extra points. +5. **Collect Fruits**: Occasionally, fruits appear in the maze. Eat them to gain extra points. +6. **Avoid Ghosts**: Avoid the ghosts moving around the maze. If a ghost touches Pac-Man, a life is lost. +7. **Game Over**: The game ends when Pac-Man loses all lives. A message will display "Game over! You lost!". +8. **Win the Game**: Collect all pac-dots to win the game. A message will display "Congratulations! You won!". ## Screenshots 📸  diff --git a/Games/Pac_Man_Game/index.html b/Games/Pac_Man_Game/index.html index c435db18b0..fbcaa99a25 100644 --- a/Games/Pac_Man_Game/index.html +++ b/Games/Pac_Man_Game/index.html @@ -5,24 +5,54 @@Use the ⬅️ ⬆️ ➡️ ⬇️ arrow keys to move Pac-Man!
+