Releases: stuffbymax/bash-pac
v1.2.1
1.2.0
fixed bugs
- fixed enemy movement
- fixed score
- fixed enemy collecting score
- fixed collisions
added feature's
- score menu
- score saving
- better menu
what change
Color Variables: These variables define ANSI escape codes for different colors, allowing the script to print colored text in the terminal. Each variable corresponds to a specific color.
display_animation Function: This function introduces the game by displaying a simple animation. It clears the screen and prints frames of the animation with short delays using the sleep command.
spawn_enemy Function: When called, this function randomly places additional enemies (ghosts) on the game board. It calculates random row and column coordinates within the board boundaries and updates the board array accordingly.
start_game Function: This function initializes the game environment and contains the main game loop. It sets up variables such as player and enemy characters, defines the game board layout, and manages player input and game state.
Printing Functions: print_board: Clears the screen and prints the current state of the game board along with the player's score. The score is displayed in different colors based on its value (red for low scores, green for high scores, and yellow for scores in between).
Movement Functions: move_player: Handles the movement of the player character based on user input. It checks if the new position is valid (not a wall) and updates the board accordingly. move_ghosts: Manages the movement of enemy characters (ghosts) on the game board. It calculates the optimal direction for each ghost to move closer to the player.
Game Over Functions: game_over_with_timer: Handles the game over scenario when the player loses (e.g., collides with a ghost). It prompts the player to play again, return to the main menu, or quit the game. game_over_with_victory: Displays a victory message when the player successfully collects all the food items on the board.
Utility Functions: spawn_ghosts: Places ghosts at random positions on the game board. spawn_food: Randomly generates food items on the game board. is_valid_position: Checks if a given position is within the bounds of the game board and not occupied by a wall.
Menu Functions: display_help: Displays instructions and controls for playing the game. save_score: Allows the player to save their score by entering their name
. view_scores: Displays the highest scores achieved by players.
exit_game: Exits the script gracefully.
main_menu: Displays the main menu options and handles user input. Main Menu:
v1.1.5
fixed animation fixed some bugs and bigger board is added
Full Changelog: v1.1.5...v1.1.5
v1.1.0
i did fix a some bugs in the code
This Bash script is a simple Pac-Man-like game with added features such as an animation at the start, multiple levels, and victory conditions. Let's break down its components and functionality:
Animation Function (display_animation):
This function displays a short animation of the player character (C) and the ghost character (G) moving towards each other. The animation iterates through a few frames with a short delay between each frame.
Game Initialization and Setup:
After the animation, the script enters the main menu loop, where users can choose to start the game, display help instructions, or exit the program.
Each option in the main menu corresponds to a different function (start_game, display_help, exit_game).
Start Game Function (start_game):
Initializes variables such as player, ghost, empty space, walls, food, and score.
Defines the game board as a multi-line string stored in an array.
Contains functions for printing the game board, checking valid positions, moving the player and ghosts, spawning ghosts and food, handling game over scenarios (with timer or victory condition), and resetting the game.
Enters a main game loop where the game state is updated based on user input and the positions of player and ghosts are adjusted accordingly.
Checks for game over conditions (player death or victory) and prompts the user to restart or return to the main menu.
Display Help Function (display_help):
Displays information about game controls, objectives, and in-game shortcuts.
Prompts the user to press Enter to continue.
Main Menu Function (main_menu):
Displays the main menu options.
Reads user input for selecting an option.
Calls corresponding functions based on user choice.
Other Functions:
exit_game: Exits the script with a goodbye message.
game_over_with_victory: Displays a victory message when the player collects all the food items on the board.
spawn_food: Randomly spawns food items on the game board.
Overall, this script provides a simple but interactive Pac-Man-like gaming experience within the Bash shell, complete with animations, multiple levels, and victory conditions.
Full Changelog: bash-pacv1.0.0...bash-pacv1.1.0
v1.0.0
This Bash script is a simple Pac-Man-like game with added features such as an animation at the start, multiple levels, and victory conditions. Let's break down its components and functionality:
Animation Function (display_animation):
This function displays a short animation of the player character (C) and the ghost character (G) moving towards each other. The animation iterates through a few frames with a short delay between each frame.
Game Initialization and Setup:
After the animation, the script enters the main menu loop, where users can choose to start the game, display help instructions, or exit the program.
Each option in the main menu corresponds to a different function (start_game, display_help, exit_game).
Start Game Function (start_game):
Initializes variables such as player, ghost, empty space, walls, food, and score.
Defines the game board as a multi-line string stored in an array.
Contains functions for printing the game board, checking valid positions, moving the player and ghosts, spawning ghosts and food, handling game over scenarios (with timer or victory condition), and resetting the game.
Enters a main game loop where the game state is updated based on user input and the positions of player and ghosts are adjusted accordingly.
Checks for game over conditions (player death or victory) and prompts the user to restart or return to the main menu.
Display Help Function (display_help):
Displays information about game controls, objectives, and in-game shortcuts.
Prompts the user to press Enter to continue.
Main Menu Function (main_menu):
Displays the main menu options.
Reads user input for selecting an option.
Calls corresponding functions based on user choice.
Other Functions:
exit_game: Exits the script with a goodbye message.
game_over_with_victory: Displays a victory message when the player collects all the food items on the board.
spawn_food: Randomly spawns food items on the game board.
Overall, this script provides a simple but interactive Pac-Man-like gaming experience within the Bash shell, complete with animations, multiple levels, and victory conditions.
Full Changelog: bash...bash-pacv1.0.0
v0.9.0
This Bash script is a simple Pac-Man clone. Here's a breakdown of its components and functionality:
Initialization:
The script starts with the shebang #!/bin/bash, indicating it's a Bash script.
It defines several variables representing game elements such as the player, ghost, walls, food, and score.
It initializes the game board using a multi-line string stored in an array called board.
Functions:
print_board: Prints the current state of the game board along with the player's score.
is_valid_position: Checks if a given position is within the bounds of the game board.
move_player: Moves the player character based on user input (WASD keys) and updates the game board accordingly.
move_ghosts: Moves the ghost character(s) based on their AI behavior and updates the game board.
spawn_ghosts: Places the ghost character(s) on the game board at predefined positions.
game_over_with_timer: Handles the game over scenario by asking the player if they want to restart.
reset_game: Resets the game to its initial state.
Main Game Loop:
The script enters an infinite loop where it repeatedly prints the game board, reads user input, moves the player and ghosts accordingly, and checks for game over conditions.
Main Menu Loop:
Before starting the game loop, the script presents a main menu with options to start the game, display help instructions, or exit the program.
Depending on the user's choice, it calls the corresponding functions (start_game, display_help, exit_game).
User Interaction:
Users control the player character using the WASD keys.
They can exit the program using the 'Q' key or the '3' option from the main menu.
Help Information:
The display_help function provides instructions on how to play the game and navigate within it.
Overall, this script provides a basic Pac-Man-like gaming experience within the Bash shell. Players can move around, collect food, avoid ghosts, and interact with the game through simple keyboard inputs.