Top Down Racing
March 2021 - April 2021
A top down 2D racing game where you race a custom AI car.
Project Overview
Race around a custom track against an AI opponent, pass through all checkpoints, and cross the finish line first! Customize your track background and define your AI's racing path via a simple text file.
This is a top-down 2D racing game built with Python and Pygame. Players control a custom car sprite and race against an AI. The AI's path is loaded dynamically through a text file (AI.txt), allowing for map modding and custom challenges. The objective is to pass through all rings (checkpoints) and beat the AI to the finish.
- Loads directional car sprites and places the player on the track
- Handles input to update position and sprite direction
- AI.txt contains a list of X,Y coordinates
- AI moves through these points in order, simulating a racing path
- Represent checkpoints around the track
- Player must pass through all to finish the race
- Once completed, the timer ends, and the high score is recorded
- Timer starts on game load
- Stops once all rings are passed
- High score saved to highscore_list.txt in hh:mm:ss.ss format
Player Initialization
AI Movement
Power-Ups / Rings
Timer and Scoring
Project Features
- đ Custom top-down sprites for player and AI
- đ§ AI pathing from external AI.txt file (easy to mod!)
- đ Changeable background images for track customization
- â Power-up / checkpoint ring system to guide gameplay
- đšī¸ Keyboard-driven player controls with directional sprite changes
- âąī¸ Finish-time tracking and high score system (written to a file)
Gameplay
You control a car from a top-down view using arrow keys or WASD. Pass through each power-up ring to progress. Once all rings are passed, the timer stops and your time is saved.
Controls:
- â / W..............Move Up
- â / S..........Move Down
- â / A...........Move Left
- â / D.........Move Right
Technologies Used
- đ Python 3.9
- đŽ Pygame
- đŧī¸ Custom sprites and background images
- đ§ Text-based AI scripting (AI.txt)
-
đ File I/O: Reads from
AI.txt, writes tohighscore.txt