This repository consists of the code that was used to create a multi-threaded snake game. In the snake game, a player controls the snake's head, and must move it using the up, down, left and right arrow keys. If the snake's head collides with any part of the snake's body, or the borders of the game board, the game is over. The snake grows by eating an apple that randomly spawns in some position of the board.
snake-gameplay-trim_VaPDI1h1.mp4
- Made with C/C++
- Includes the Allegro 4.4.2 library (a game library for C/C++ programming and includes DirectX and OpenGL to support it)
- Includes the Pthreads library for Windows
- Spawning the apple in a random location
- Handling keyboard input
- Ending the game abruptly when the ESC key is pressed
- The main thread (includes the game loop in the play_game() method)
- Background music provided by Pixabay: https://pixabay.com/music/video-games-chiptune-grooving-142242/
- Apple crunch sound by Koops: https://freesound.org/s/20279/
- End game sound provided by Pixabay: https://pixabay.com/sound-effects/videogame-death-sound-43894/