Skip to content

This is a simple Snake Game implemented in C++ using the SFML (Simple and Fast Multimedia Library) framework. The game allows the player to control a snake that moves around the screen, eating food to grow longer. The objective of the game is to avoid collisions with the snake's own body while trying to achieve the highest possible score.

License

Notifications You must be signed in to change notification settings

Mayur-Shiwal/Snake_Game_SFML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game using SFML in C++

Description

This is a simple Snake Game implemented in C++ using the SFML (Simple and Fast Multimedia Library) framework. The game allows the player to control a snake that moves around the screen, eating food to grow longer. The objective of the game is to avoid collisions with the snake's own body while trying to achieve the highest possible score.

Features

  • Classic Snake gameplay.
  • Snake grows longer each time it eats food.
  • Food spawns at random locations on the screen.
  • Game over when the snake collides with itself.
  • Display of the player's current score.
  • Display of the player's highest score.
  • Simple graphics and animations using SFML.

How to Play

  1. Use the arrow keys (Up, Down, Left, Right) to control the direction of the snake's movement.
  2. The snake will continuously move in the direction you choose.
  3. Your goal is to eat the food that appears on the screen. Each time the snake eats food, it will grow longer.
  4. Be careful not to run into the snake's own body, as this will restart the game.
  5. Try to achieve the highest possible score before the game restarts.

Dependencies

  • SFML Library (Simple and Fast Multimedia Library): Make sure to have SFML properly installed and configured in your project. You can find more information about SFML installation in the official SFML documentation.

How to Build and Run

  1. Clone this repository to your local machine.
  2. Open the project in Microsoft Visual Studio.
  3. Make sure SFML is properly linked and configured in your project settings.
  4. Build the project.
  5. Run the executable generated after building.

Controls

  • Up Arrow: Move the snake upwards.
  • Down Arrow: Move the snake downwards.
  • Left Arrow: Move the snake to the left.
  • Right Arrow: Move the snake to the right.

Contributions

Contributions to this project are welcome! If you find any bugs or want to improve the game, feel free to create a pull request or submit an issue.

License

This Snake Game is released under the MIT License.

About

This is a simple Snake Game implemented in C++ using the SFML (Simple and Fast Multimedia Library) framework. The game allows the player to control a snake that moves around the screen, eating food to grow longer. The objective of the game is to avoid collisions with the snake's own body while trying to achieve the highest possible score.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages