Skip to content

Classic Snake Game ๐Ÿ โ€“ A Retro-Style Game Like Nokia Phones! ๐Ÿ“ฑ๐ŸŽฎ Built with C++ ๐Ÿ˜

Notifications You must be signed in to change notification settings

Raj-Patel7807/Snake_Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ Snake Game


๐Ÿ“Œ Table of Contents


๐Ÿ“– Introduction

This game is made by Bitwise Wizards.This project is a console-based Snake Game implemented in C++. It follows an object-oriented approach using classes and inheritance to manage game components like the snake, fruit, and game board.Our code is for Windows and Linux. It will work in both OS.


โœจ Features

  • ๐ŸŽฏ Grid-based gameplay.
  • ๐ŸŽฎ Snake movement using keyboard controls.
  • ๐Ÿ Normal and special fruits for scoring.
  • ๐Ÿšง Obstacles appear as the game progresses.
  • ๐Ÿงฑ Wall collision mode (can be enabled or disabled).
  • ๐Ÿ”„ Dynamic difficulty adjustment.
  • ๐Ÿ“บ Clear UI with instructions and score tracking.

๐ŸŽฎ How to Play

  • Control the snake using W, A, S, D or arrow keys.
  • ๐Ÿ Eat fruits (@ for normal, $ for special) to grow and score points.
  • ๐Ÿšง Avoid walls and obstacles (#).
  • โ˜ ๏ธ Game over if the snake collides with itself or obstacles.
  • ๐Ÿ”„ Restart or exit after game over.

๐ŸŽฏ Game Controls

๐ŸŽฎ Key ๐Ÿน Action
W / โฌ†๏ธ Move Up
S / โฌ‡๏ธ Move Down
A / โฌ…๏ธ Move Left
D / โžก๏ธ Move Right
P Pause
R Resume
X Reset Game
ESC Exit Game

๐Ÿš€ Installation Guide

Follow these steps to install and run the Snake Game on your machine:

1๏ธโƒฃ Clone the Repository ๐Ÿ–ฅ๏ธ

  • Ensure you have Git installed, then run:
git clone https://github.com/Raj-Patel7807/Snake_Game.git

2๏ธโƒฃ Navigate to the Project Directory ๐Ÿ“‚

cd Snake_Game

3๏ธโƒฃ Compile the Source Code โš™๏ธ

  • Make sure you have g++ (GCC compiler) installed, then compile the code:
g++ main.cpp -o main

4๏ธโƒฃ Run & Play the Game ๐ŸŽฎ

  • For Linux Users ๐Ÿง:
./main
  • For Windows Users ๐ŸชŸ:
main.exe

5๏ธโƒฃ (Optional) Clone with SSH ๐Ÿ”‘

  • If you prefer SSH over HTTPS:
git clone git@github.com:Raj-Patel7807/Snake_Game.git

6๏ธโƒฃ (Optional) Pull Latest Updates ๐Ÿ”„

  • If you have already cloned the repo and want to get the latest updates:
git pull origin main

Enjoy the game! ๐Ÿ๐Ÿ”ฅ


๐Ÿ•น๏ธ Game Mechanics

  • ๐Ÿ The snake moves continuously in the last chosen direction.
  • ๐Ÿ Eating a normal fruit (@) increases the score by 5 points.
  • ๐Ÿ’ฐ Eating a special fruit ($) increases the score by 20 points.
  • ๐Ÿšง Once the score reaches 50, obstacles appear.
  • ๐Ÿ”ผ The difficulty increases dynamically with score progression.

๐Ÿ’ก Code Structure

The game is implemented using Object-Oriented Programming (OOP) principles:

  • ๐Ÿ› ๏ธ Game (Base Class): Defines the core game logic and properties.
  • ๐Ÿ Snake (Inherits from Game): Handles the snakeโ€™s movement.
  • ๐Ÿ Fruit (Inherits from Snake): Manages fruit generation.
  • ๐ŸŽฎ Main (Inherits from Fruit): Controls the game loop, rendering, and input handling.

๐Ÿš€ Future Enhancements

  • ๐ŸŽฎ Multiple levels with increasing complexity.
  • ๐Ÿ‘ซ Multiplayer mode with two snakes.
  • ๐Ÿ† High score tracking system.
  • ๐Ÿค– AI-controlled opponent snakes.
  • ๐ŸŽจ GUI-based version using a graphics library.

๐Ÿ‘ฅ Contributors

  • ๐Ÿ… Raj Patel
  • ๐Ÿ… Tirth Patel

Happy Coding ๐Ÿง‘๐Ÿปโ€๐Ÿ’ปโœจ

About

Classic Snake Game ๐Ÿ โ€“ A Retro-Style Game Like Nokia Phones! ๐Ÿ“ฑ๐ŸŽฎ Built with C++ ๐Ÿ˜

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages