Snake game made using tikinter library from Python for the GUI. Key Features: -Snake movement using arrow keys -Randomly placed food (postions) -Snake grows each time it consumes food -Game ends if the snake collides in the wall or itself
Functions: -change_direction(e): Changes the direction of the snake based on the key pressed. -check_collisions(): Checks for collisions with the walls and the snake itself. -check_food_collision(): Checks if the snake has collided with the food. -move_snake(): Moves the snake and handles the logic for growing the snake and checking collisions. draw(): Draws the snake, food, and score on the canvas. Also handles game over state.
Requirements:
- Python 3
How to play: Run the script: python snake_game.py (In the terminal or cmd)
Installation: Clone the repository:
git clone https://github.com/SammanBaidya/snake-game.git
cd snake-game