Skip to content

Latest commit

 

History

History
96 lines (70 loc) · 4.85 KB

README.md

File metadata and controls

96 lines (70 loc) · 4.85 KB

Snake Game

This is my submisson for Capstone project in the Udacity C++ Nanodegree Program.

Dependencies for Running Locally

  sudo apt-get install libsdl2-ttf-dev

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory in the top level directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run it: ./SnakeGame.

Note: CMake throws the following errors, you may ignore :

-- Could NOT find SDL2TTF (missing: SDL2TTF_INCLUDE_DIRS) 
-- Could NOT find SDL2MIXER (missing: SDL2MIXER_INCLUDE_DIRS) 

Scope & Implementations

Original fork implements the basic game and challenges you to understand and develop further features. For my flavour of the Snake Game, I selected some features that added more intuitiveness and made it a whole game.

  1. Add Boosts & Penalties to add dynamism.
  2. Play game for longer/continue playing without exiting.
  3. Add Time based challenges.
  4. Add game music.
  5. Make all game features accessible inside the window.

I have successfully implemented everything except the 3rd feature which later came to realize wasn't that fun to implement.

Boosts and Penalties

In the game Green blocks are food, they grow the length of the snake and also increase speed of movement. Brown block is the Morgue, which when met will kill the snake and the game will end. Yellow blocks give a chance to decrease the speed of snake by a little and reduce length of the snake while still keeping the score. As the snake keeps eating the food the speed will be difficult to manage so the player can use this as a way to keep them in the game. Speed reduction is set at 1/10th right now.

Play game for longer/continue playing without exiting.

I have implemented a Start and End screen that way player can choose to continue to play or exit. End screen displays the score and pressing ENTER key allows player to play again. At any point in the game if player presses 'ESC key quits the game.

Game music

When playing the game song "Bit of Hope" is played in the background. Implemented using the SDL_Mixer.

Make all game features accessible inside the window

Developed a Start and End Game screen. Using SDL_TTF imported True-Type-Fonts and displays the game name and presents control options to the player.

Expected Behavior

On game launch Press ENTER key to play, ESC key to quit. The game starts and spawns the Snake Head(Blue), a Food block(Green), a Lemon(Shrinking Food - Yellow) & a Morgue(Kills - Brown). Player to use the keyboard arrow keys to change the direction of the snake travel.

  • Eating Green colored block scores a point and increases the length and speed of the snake.
  • Eating Yellow colored block scores no points and decreases the length of the snake.
  • Eating Brown colored block kills the snake and ends the game.

If the snake goes to the Brown block/Morgue snake dies, or if you circle back the snake head to snake body snake will die.

On the Game End screen player score is displayed and can press ENTER key to play again or press ESC key to quit the game.

CC Attribution-ShareAlike 4.0 International

Shield: CC BY-SA 4.0

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

CC BY-SA 4.0

"A bit of Hope" is Royalty Free Music from : https://www.fesliyanstudios.com/

Game fonts are form https://www.fontspace.com. 'Debrosee-ALPnL' for Game Title, and 'SummerPixel' for game menu.