This game is a modern take on the classic Snake game, designed using Object-Oriented Design (OOD) principles to ensure modularity, efficiency, and maintainability. It includes exciting gameplay mechanics such as multi-food spawning, special food generation, and dynamic player movement.
- C++: Core language for implementing the game logic and mechanics.
- Ncurses Library: For rendering the game on the console with smooth and interactive visuals.
- Object-Oriented Design Principles: To ensure modular, reusable, and maintainable code through encapsulation, inheritance, and polymorphism.
- Dynamic Memory Management: To efficiently handle the game's data structures and objects.
- Multi-Food Spawning: Generates up to three food items on the board at random positions.
- Special Food Mechanic: Includes a chance for special food to spawn, adding strategic elements to the gameplay.
- Player Movement & Collision Detection: Smooth directional controls with robust collision detection to handle food pickups and self-collisions.
- Dynamic Snake Growth: The snake grows in size as it consumes food, maintaining its position on the board efficiently.
- Boundary Wrapping: Snake reappears on the opposite edge of the board when moving out of bounds.
- Run the Game: Compile the project files and execute the game in your terminal.
- Controls: Use the following keys to control the snake:
W
orw
: Move UpA
ora
: Move LeftS
ors
: Move DownD
ord
: Move RightEsc
: Exit the game
- Objective: Eat food to grow the snake and increase your score. Avoid colliding with yourself!
GameMechs.cpp
andGameMechs.h
: Manage core game mechanics and input handling.Player.cpp
andPlayer.h
: Handle player movement, snake growth, and collision logic.Food.cpp
andFood.h
: Define food spawning, including special food mechanics.objPos.cpp
andobjPos.h
: Represent positions on the board and provide utilities for comparisons.objPosArrayList.cpp
andobjPosArrayList.h
: Custom array list implementation to manage snake body and food positions.
- Add more advanced gameplay features like obstacles and levels.
- Implement a graphical user interface (GUI) for a more immersive experience.
- Include a leaderboard to track high scores.
Enjoy playing the Snake Game! 🐍