A simple Snake Game built using Python and the Pygame library. Control the snake, eat the food, and try to achieve the highest score without colliding with the walls or the snake's own body.
- Dynamic Gameplay: The snake grows in length as it eats the food.
- Collision Detection: The game ends if the snake collides with the walls or itself.
- Custom Borders: Added decorative yellow borders around the frame.
- Scoring System: Displays the player's score in real-time.
- Run the game script using Python.
- Use the arrow keys to control the snake's direction:
- Left Arrow: Move left
- Right Arrow: Move right
- Up Arrow: Move up
- Down Arrow: Move down
- Eat the blue food to grow the snake and increase your score.
- Avoid colliding with the walls or the snake's body.
- If you lose, press Q to quit or C to restart the game.
- Arrow Keys: Move the snake.
- Q: Quit the game.
- C: Restart the game after losing.
- Python 3.x
- Pygame library
To install Pygame, run the following command:
pip install pygame
our_snake(snake_block, snake_list)
: Renders the snake on the screen.message(msg, color)
: Displays a message on the screen.gameLoop()
: Contains the main game logic, including player input, collision detection, and rendering.
- The game screen is dynamically updated at a speed of 12 frames per second (modifiable).
- Food placement is randomized, ensuring new positions each time food is eaten.
- A border surrounds the game area, enhancing the visual appeal.
- Clone or download this repository.
- Navigate to the project directory.
- Run the script using the following command:
python snake_game.py
- Built with 💻 and 🎮 by Python and Pygame.
- Inspired by the classic Snake game (NoKia).