Skip to content

Latest commit

ย 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Snake Game 2D

Welcome to Snake Game 2D! This is a classic arcade-style game where you control a snake, guiding it to eat food and grow while avoiding collisions with walls and its own tail. This project utilizes C++ and the SFML library for graphics rendering and user input handling.

Requirements

To compile and run Snake Game 2D, you need the following:

  • SFML (Simple and Fast Multimedia Library): SFML is a cross-platform and easy-to-use library for developing multimedia applications and games in C++. It handles graphical rendering, keyboard input, and window events.

  • iostream: Standard C++ library for input and output operations, used for printing messages to the console, such as "Game Over".

  • cstdlib and ctime: Standard C++ libraries for time manipulation and random number generation, utilized for generating random positions for food and obtaining the current time.

  • deque: Standard C++ double-ended queue data structure used for storing the segments of the snake in the game.

Dependencies

Snake Game 2D depends on the following SFML libraries:

  • sfml-graphics
  • sfml-window
  • sfml-system

Usage

To compile the Snake Game 2D, you need to follow these steps:

  1. Create Directories: Create /bin and /build directories in the root of the repository. You can do this using the following commands:

    mkdir bin
    mkdir build
  2. Compile with Makefile: Navigate to the root directory of the project and run the following command in your terminal:

    make

    This command will compile the source files and link them with the necessary SFML libraries. After successful compilation, the executable will be placed in the /bin directory.

  3. Run the Game: Execute the generated executable file located in the /bin directory:

    ./bin/snake_game

Enjoy playing Snake Game 2D!


Thank you for choosing Snake Game 2D! If you have any questions, issues, or suggestions, please don't hesitate to reach out. Happy gaming! ๐Ÿ๐ŸŽฎ



Static Badge Static Badge Static Badge Static Badge

About

Snake Game 2D: Classic arcade fun! Control the snake, eat, grow, and avoid collisions. C++, SFML, and Makefile for seamless gaming. ๐Ÿ๐ŸŽฎ

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages