A classic "Frogger"-style arcade game built entirely in Python using the turtle module. The objective is to guide a small turtle from the bottom of thescreen to the safe zone at the top, dodging a constant stream of fast-moving cars.
This project demonstrates the principles of Object-Oriented Programming (OOP) by separating the game's components into different classes:
- Player: The turtle you control.
- CarManager: Responsible for generating, moving, and managing all the car obstacles.
- Scoreboard: Keeps track of the player's current level.
The game's difficulty increases with each successful crossing. The cars speed up and spawn more frequently, making each new level a greater challenge.
- Classic Arcade Feel: Simple, intuitive, and addictive gameplay.
- Player Control: Move the turtle forward with the "Up" arrow key.
- Dynamic Obstacles: Cars are randomly generated at different starting positions and move across the screen.
- Increasing Difficulty:
- Cars move faster every time you level up.
- Cars spawn more frequently as the level increases.
- Scorekeeping: The scoreboard displays the current level, which increases with each successful crossing.
- Collision Detection: The game instantly ends if the turtle collides with a car.
- Python 3
- Turtle Graphics (Python's built-in library)
You must have Python 3 installed on your system. The turtle module is included in the Python standard library, so no extra installations are needed.
- Clone the repository:
git clone [https://github.com/Spargerx/Turtle_Crossing_game.git](https://github.com/Spargerx/Turtle_Crossing_game.git)
- Navigate to the project directory:
cd Turtle_Crossing_game - Run the game:
python main.py
- Move Forward:
Up Arrow
The game is built using four main Python files:
main.py: This is the entry point of the game. It sets up the screen, initializes all the game objects (player, cars, scoreboard), and contains the main game loop and event listeners.player.py: Defines thePlayerclass (which inherits fromTurtle). It handles the turtle's starting position, appearance, and move logic.car_manager.py: Defines theCarManagerclass. This class is responsible for creating new cars, moving all cars, and increasing their speed when the player levels up.scoreboard.py: Defines theScoreboardclass (which inherits fromTurtle). It handles writing the current level to the screen and displaying the "GAME OVER" message.
