Boa Bomb
Welcome to Boa Bomb, an exciting twist on the classic snake game. In this game, you navigate a snake through a field, collecting apples and special items, while avoiding dangerous obstacles. Get ready for an engaging gameplay experience with enhanced features and challenges!
Getting Started
Prerequisites Ensure you have a suitable C++ compiler installed on your system to compile the game. Clone or download this repository to your local machine.
Installation Open your terminal or command prompt. Navigate to the directory where you have cloned or downloaded the game files.
As you progress, feel the excitement of real-time gameplay that never stops. Get ready for an exhilarating journey that will push your abilities to the maximum.
Travel through a lively, action-packed universe. Discover further autonomous snakes, ringing time bombs, and alluring apples that are just begging to be picked. In this complex game, every action matters.
Dive into an arcade-style encounter that combines easy controls with quick action. BoaBomb provides an engaging gaming experience that's simple to get into but challenging to master, leaving you wanting more.
As you navigate a number of obstacles, test your reflexes and strategic thinking. BoaBomb is made to enthrall players with its captivating dynamics, providing a great fusion of challenge and enjoyment.
Come along on the thrilling journey of BoaBomb, where there will be surprises around every corner. Do you feel up to the challenge?
- Start: Press Enter to begin the game.
- Move: Use arrow keys to control the snake's direction.
- Restart: Press 'R' to restart the game when in the Game Over screen.
- Exit: Press ESC to exit the game.
- Snake: Control the green snake and guide it through the maze.
- Apples: Collect red apples to increase your score.
- Golden Apple: Appears after eating a certain number of normal apples. Eating it increases the snake's length significantly.
- Bombs: Avoid bombs; they change locations and are deadly.
- NPCs (Non-Playable Characters): Beware of arrows; if they touch the snake's head, it's game over.
- Displays the game title, start prompt, and instructions.
- Press Enter to start the game.
- Control the snake using arrow keys.
- Avoid bombs and arrows.
- Collect apples to increase your score.
- Displays "Game Over" along with your final score.
- Press 'R' to restart or ESC to exit.
Prerequisites: Ensure you have a suitable C++ compiler installed on your system to compile the game.
Installation:
- Clone or download this repository to your local machine.
- Open your terminal or command prompt.
- Navigate to the directory where you have cloned or downloaded the game files.
Compile and Run:
- There needs to be an OpenGL library installed on the local computer
- Compile the code using a C++ compiler (For CSIL)
- clang++ main.cpp -o play -lGL -lGLU -lglut
- Compile the game by typing (For MacOS)
- make
- After successful compilation, start the game by entering:
- ./play
- Header Files
- gameConstants.h
- globals.h
- playerScore.h
- Source Files
- draw.cpp
- game.cpp
- place.cpp
- main.cpp
-
drawApple():
Draws a red apple at the specified coordinates. -
drawGoldenApple():
Draws a golden apple at the specified coordinates if it is active. -
drawBomb():
Draws a bomb at the specified coordinates with a color that changes based on the bomb's tick limit. -
drawSnake():
Draws the snake's body using green squares. -
drawNPC(int x, int y):
Draws a non-playable character (NPC) represented by a white square at the specified coordinates (x, y). -
drawBoundary():
Draws the boundary of the game area as a brown rectangle. -
drawScore():
Displays the player's score at the top left corner of the window. -
drawMenu():
Displays the game title, start prompt, and instructions on the menu screen. -
drawGameOverScreen():
Displays the "Game Over" screen, including the final score and options to restart or exit.
-
init():
Initializes the game state, setting the initial positions of the apple, snake, and other variables. Also, sets the background color. -
display():
Renders the game screen based on the current game state, drawing elements such as the snake, NPCs, apples, bombs, and the boundary. -
keyboard(int key, int, int):
Handles special key input, such as arrow keys, to control the snake's movement. -
checkCollision(int x1, int y1, int size1, int x2, int y2, int size2):
Checks for collision between two objects given their coordinates and sizes. -
checkBombCollision():
Checks for collision between the snake's head and a bomb, considering the bomb's tick limit. -
resetGame():
Resets the game state, including the snake's length, apple positions, and other variables, preparing for a new game. -
update(int):
Updates the game state, including snake movement, collision checks, and NPC updates. It also handles the bomb's ticking mechanism. -
keyboardRegular(unsigned char key, int x, int y):
Handles regular key input, such as 'R' for restarting the game or ESC for exiting.
placeApple():
- Places a regular apple randomly within game boundaries.
- Ensures no overlap with the snake's body or the bomb.
- Uses a loop for random coordinate generation until a suitable position is found.
placeGoldenApple():
- Places a golden apple with specific criteria for positioning.
- Avoids overlap with the snake, normal apples, or the bomb.
- Uses a loop to find a suitable location.
placeBomb():
- Places a bomb randomly within game boundaries.
- Ensures no immediate collision with the snake or existing apples.
- Resets the bomb's tick count and tick timer for the next round.
main(int argc, char** argv):
- The main entry point of the program. Initializes GLUT, sets up the display, keyboard input, and timer for game updates.
- It then enters the main GLUT event loop.
For any issues or questions regarding the game, please feel free to open an issue in this repository. Our team will promptly address your concerns and provide assistance as needed. We appreciate your feedback and are committed to ensuring you have an enjoyable gaming experience.
Thank you for playing BoaBomb!
Member Names:
- Ivan
- Jenil
- Justin
- Sanil