Skip to content

Updated the Human controlled Snake game - #29

Open
Asmaaad37 wants to merge 1 commit into
patrickloeber:mainfrom
Asmaaad37:main
Open

Updated the Human controlled Snake game#29
Asmaaad37 wants to merge 1 commit into
patrickloeber:mainfrom
Asmaaad37:main

Conversation

@Asmaaad37

Copy link
Copy Markdown

Added following features and some basic functionalities to enhance the user experience:

  • Pause/Resume Functionality: Now the player can pause and resume mid-game with a key (Space).
  • Game Over Screen: A proper game over screen is shown to the user instead of immediately closing the game, and it also displays the final score and and allows replay without restarting the program.
  • Difficulty Levels: Added progressive difficulty feature, each time you eat food (Score + 1), the snake moves slightly faster. The formula is: Current Speed = 20 + (Score * 0.5).
  • Reverse Direction Prevention: Added is_valid_direction() method that prevents the snake from moving directly opposite to its current direction, If the snake is moving RIGHT, it can't immediately turn LEFT (and vice versa for UP/DOWN).
  • On-Screen Instructions: Added instruction text at the bottom of the game screen,
    Displays: "Arrow Keys: Move | SPACE: Pause | ESC: Quit".

FLOW

  1. Start Screen - Shows controls and waits for any key press
  2. Gameplay - Clean UI with only current score and speed
  3. Game Over Screen - Shows final score and high score for comparison
  4. Restart or Quit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant