Skip to content

Interactive Snake game in C++ with 4 exciting speed levels In Console App

License

Notifications You must be signed in to change notification settings

waelodeh98/SnakeGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐍 Snake Game (C++ Console)

A console-based Snake Game developed in C++ with colorful terminal output, sound effects, and multiple difficulty levels. The game runs on Windows and provides an interactive console experience.

✨ Features

🟒 Multiple difficulty levels: Easy, Medium, Hard, Very Hard

🎨 Colored console interface using ANSI escape codes

πŸ”Š Sound effects for eating fruits and losing (Windows PlaySound)

πŸ”’ Dynamic snake tail movement

πŸ•ΉοΈ Real-time input using keyboard (w, a, s, d)

πŸ† Score tracking and automatic game over detection

πŸ”„ Option to play again without restarting the program

πŸ•ΉοΈ Gameplay

The game starts with a main menu to choose the difficulty level.

Snake starts at the center of the map.

Player moves the snake using keys:

w β†’ Up

s β†’ Down

a β†’ Left

d β†’ Right

Eat fruits ($) to increase score and grow the tail.

Hitting walls or the snake tail ends the game.

After losing, you can choose to play again.

🎯 Controls

w, a, s, d β†’ Move the snake

x β†’ Exit the game

Y / N β†’ Play again or exit

πŸ› οΈ Technologies Used

Language: C++ Platform: Windows

Libraries & Headers:

β†’ Input/output

β†’ Random number generation

<conio.h> β†’ Real-time key input

<windows.h> β†’ Console manipulation & Sleep

<mmsystem.h> β†’ Play sound effects

Concepts:

Arrays & structures

Functions

Loops & conditions

Enums

Random number generation

Console cursor manipulation

▢️ How to Run

Make sure you are using Windows.

Compile the code using a C++ compiler (e.g., MinGW or Visual Studio).

Run the executable from the console.

Example (MinGW):

g++ snake_game.cpp -o snake_game snake_game

πŸ“Έ Screenshots

Gameplay Screenshot

Gameplay Screenshot 2

πŸ“Œ Notes

This project is designed for learning C++ fundamentals and practicing console application development.

Sound effects work only on Windows OS.

Difficulty levels control the speed of the snake (Lower value = faster movement).

πŸ‘€ Author

Wael Samer Software Engineering Student

GitHub: github.com/waelodeh98
LinkedIn: linkedin.com/in/wael-samer

About

Interactive Snake game in C++ with 4 exciting speed levels In Console App

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published