MrTimmyJ

Main Project Image

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.

Project Detail Image

    Player Initialization

  • Loads directional car sprites and places the player on the track
  • Handles input to update position and sprite direction
  • AI Movement

  • AI.txt contains a list of X,Y coordinates
  • AI moves through these points in order, simulating a racing path
  • Power-Ups / Rings

  • 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 and Scoring

  • Timer starts on game load
  • Stops once all rings are passed
  • High score saved to highscore_list.txt in hh:mm:ss.ss format

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)
Project Detail Image

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.

Project Detail Image

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 to highscore.txt