Python Snake Game
1. Basic Features
You are expected to implement a variant of the classic snake game written in Python.
The game utilizes the tkinter library to create a graphical user interface, providing an intuitive user
interaction experience.
Players control a snake moving on the screen, eating the food to grow in length while avoiding
collisions with walls and themselves.
The game should support the following features:
- Preliminary Snake Game Rules (10 pts). The logical layer of your program should support the following game
rules:
- The player's goal is to control a snake to eat as much food as possible, causing the snake to grow longer
and learning a higher score.
- The snake continuously moves forward, and the player can control its direction to find food at a fixed
speed.
- Food items randomly appear on the game board, typically represented as small dots or icons. The snake must
consume these food items to increase its length and score. Once the snake eats the food, new food spawns at
another location on the map.
- Every time the snake consumes food, its length increases by one unit (usually equivalent to one snake
head's
length).
- The game ends under the following conditions: The snake collides with the boundaries of the game area. The
snake collides with its own body, essentially running into itself.
- Python GUI (10 pts). You are required to implement a GUI for the game. The GUI should be implemented in
Python Tkinter package.
It should support the following features, i.e. the GUI should be able to display:
- You can utilize Tkinter's Canvas component to draw game elements such as the snake, food, etc.
- Game over message should be displayed upon game failure.
- The snake, food, and background colors should be different.
- Direct Keyboard Control (10 pts). The GUI should support direct keyboard control, capturing keyboard events to control the snake's direction (up, down, left, or right).
2. Advanced Features
Note that you can earn 90% of the scores by finishing all three projects with the only basic features.
That is to say, to get a higher score, you may want to consider adding some advanced features:
(Please pick some features from the followings.
The corresponding bonus scores will be added to your final score,
and the upper bound of your final score is 100 pts.
That's to say, you can get at most 100 pts by picking two 5 pts features or one 10 pts feature.)
- Different Effects of Food (10 pts) Different types of food are generated randomly.
You simply need to add two additional types of food.
Some foods may increase the snake's length of two units, while others may change (speed or slow) the snake's speed. Different types of food should be distinguished by using different colors.
- Adding Obstacles (5 pts) The game ends if the snake collides with obstacles, you can randomly generate obstacles in the game scene adding extra challenges.
- Multi-Level Challenges (10 pts) Different game levels can be added, each with varying difficulties and layouts.
At least two levels should be designed, with each level automatically proceeding to the next after reaching a specified score.
- Dynamic velocity (5 pts) As time passes, You can gradually increase the snake's movement speed.
- menu screen (5 pts) You can customize the theme to design a game menu that includes two button controls: 'Start Game' and 'Exit Game'.
- Other cool features (5 pts): If you have other cool ideas for improving your project, please let me
know as early as possible. (Before Apr. 20th, 2023) I will consider whether it can be an alternative.