I'll create a retro 80's-style horse racing arcade game using Python and Pygame. This will have that classic pixelated look with bright colors and simple graphics.
import pygame
import random
import math
import sys
# Initialize Pygame
pygame.init()
# Constants
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
FPS = 60
# Colors (classic 80's arcade palette)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255, 255, 0)
MAGENTA = (255, 0, 255)
CYAN = (0, 255, 255)
ORANGE = (255, 165, 0)
PURPLE = (128, 0, 128)
LIME = (50, 205, 50)
PINK = (255, 192, 203)
# Horse colors
HORSE_COLORS = [RED, GREEN, BLUE, YELLOW, MAGENTA, CYAN, ORANGE, PURPLE]
class Horse:
def __init__(self, x, y, color, lane):
self.x = x
self.y = y
self.color = color
self.lane = lane
self.speed = random.uniform(1.5, 3.0)
self.base_speed = self.speed
self.stamina = random.uniform(0.8, 1.2)
self.animation_frame = 0
self.finished = False
self.finish_time = 0
self.position = 0
def update(self):
if not self.finished:
# Add some randomness to speed for realistic racing
speed_variation = random.uniform(-0.5, 0.5)
current_speed = self.base_speed + speed_variation
# Stamina affects speed over time
race_progress = self.x / (SCREEN_WIDTH - 100)
stamina_factor = 1.0 - (race_progress * (1.0 - self.stamina))
self.speed = current_speed * stamina_factor
self.x += self.speed
# Animation
self.animation_frame += 0.3
# Check if finished
if self.x >= SCREEN_WIDTH - 80:
self.finished = True
self.x = SCREEN_WIDTH - 80
def draw(self, screen):
# Horse body (simple pixel art style)
body_width = 40
body_height = 20
# Body
pygame.draw.rect(screen, self.color,
(self.x, self.y, body_width, body_height))
# Head
pygame.draw.rect(screen, self.color,
(self.x + body_width, self.y + 5, 15, 10))
# Legs (animated)
leg_offset = int(math.sin(self.animation_frame) * 3) if not self.finished else 0
# Front legs
pygame.draw.rect(screen, self.color,
(self.x + 30, self.y + body_height, 3, 10 + leg_offset))
pygame.draw.rect(screen, self.color,
(self.x + 25, self.y + body_height, 3, 10 - leg_offset))
# Back legs
pygame.draw.rect(screen, self.color,
(self.x + 10, self.y + body_height, 3, 10 - leg_offset))
pygame.draw.rect(screen, self.color,
(self.x + 5, self.y + body_height, 3, 10 + leg_offset))
# Mane
pygame.draw.rect(screen, WHITE,
(self.x + 20, self.y - 5, 15, 8))
# Eye
pygame.draw.circle(screen, WHITE,
(self.x + body_width + 8, self.y + 8), 2)
pygame.draw.circle(screen, BLACK,
(self.x + body_width + 8, self.y + 8), 1)
class RaceTrack:
def __init__(self):
self.lanes = 8
self.lane_height = (SCREEN_HEIGHT - 200) // self.lanes
def draw(self, screen):
# Draw grass background
screen.fill(LIME)
# Draw track lanes
track_start_y = 100
for i in range(self.lanes + 1):
y = track_start_y + i * self.lane_height
pygame.draw.line(screen, WHITE, (50, y), (SCREEN_WIDTH - 50, y), 2)
# Draw start line
pygame.draw.line(screen, WHITE, (60, track_start_y),
(60, track_start_y + self.lanes * self.lane_height), 4)
# Draw finish line
finish_x = SCREEN_WIDTH - 70
pygame.draw.line(screen, WHITE, (finish_x, track_start_y),
(finish_x, track_start_y + self.lanes * self.lane_height), 4)
# Checkered pattern for finish line
for i in range(0, self.lanes * self.lane_height, 20):
for j in range(0, 4, 10):
if (i // 20 + j // 10) % 2:
pygame.draw.rect(screen, BLACK,
(finish_x + j, track_start_y + i, 10, 10))
class Game:
def __init__(self):
self.screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("RETRO HORSE RACING - Press SPACE to Start!")
self.clock = pygame.time.Clock()
self.font_large = pygame.font.Font(None, 48)
self.font_medium = pygame.font.Font(None, 32)
self.font_small = pygame.font.Font(None, 24)
self.track = RaceTrack()
self.horses = []
self.race_started = False
self.race_finished = False
self.start_time = 0
self.finish_order = []
self.game_state = "menu" # menu, racing, results
self.create_horses()
def create_horses(self):
self.horses = []
track_start_y = 100
lane_height = self.track.lane_height
horse_names = ["THUNDER", "LIGHTNING", "STORM", "BLAZE",
"ROCKET", "COMET", "FLASH", "SPIRIT"]
for i in range(8):
y = track_start_y + i * lane_height + lane_height // 2 - 15
horse = Horse(70, y, HORSE_COLORS[i], i)
horse.name = horse_names[i]
self.horses.append(horse)
def start_race(self):
self.race_started = True
self.race_finished = False
self.start_time = pygame.time.get_ticks()
self.finish_order = []
self.game_state = "racing"
# Reset horses
for horse in self.horses:
horse.x = 70
horse.finished = False
horse.speed = random.uniform(1.5, 3.0)
horse.base_speed = horse.speed
horse.stamina = random.uniform(0.8, 1.2)
def update(self):
if self.game_state == "racing" and self.race_started:
for horse in self.horses:
if not horse.finished:
horse.update()
# Check if horse just finished
if horse.finished and horse not in self.finish_order:
horse.finish_time = pygame.time.get_ticks() - self.start_time
horse.position = len(self.finish_order) + 1
self.finish_order.append(horse)
# Check if race is complete
if len(self.finish_order) == len(self.horses):
self.race_finished = True
self.game_state = "results"
def draw_menu(self):
self.screen.fill(BLACK)
# Title with retro effect
title_colors = [RED, YELLOW, GREEN, CYAN, MAGENTA]
title_text = "RETRO HORSE RACING"
for i, color in enumerate(title_colors):
offset = i * 2
text = self.font_large.render(title_text, True, color)
text_rect = text.get_rect(center=(SCREEN_WIDTH//2 + offset, 150 + offset))
self.screen.blit(text, text_rect)
# Instructions
instructions = [
"PRESS SPACE TO START RACE",
"PRESS R TO RESTART",
"PRESS Q TO QUIT",
"",
"Watch the horses race to the finish!",
"Each horse has different speed and stamina."
]
for i, instruction in enumerate(instructions):
color = WHITE if instruction else BLACK
text = self.font_medium.render(instruction, True, color)
text_rect = text.get_rect(center=(SCREEN_WIDTH//2, 300 + i * 40))
self.screen.blit(text, text_rect)
def draw_racing(self):
self.screen.fill(BLACK)
self.track.draw(self.screen)
# Draw horses
for horse in self.horses:
horse.draw(self.screen)
# Draw horse names and positions
for i, horse in enumerate(self.horses):
# Horse number and name
name_text = f"{i+1}. {horse.name}"
text = self.font_small.render(name_text, True, horse.color)
self.screen.blit(text, (10, 110 + i * self.track.lane_height))
# Position indicator
if horse.finished:
pos_text = f"#{horse.position}"
pos_surface = self.font_small.render(pos_text, True, WHITE)
self.screen.blit(pos_surface, (horse.x - 20, horse.y - 20))
# Race timer
if self.race_started:
elapsed = (pygame.time.get_ticks() - self.start_time) / 1000.0
timer_text = f"TIME: {elapsed:.1f}s"
timer_surface = self.font_medium.render(timer_text, True, WHITE)
self.screen.blit(timer_surface, (SCREEN_WIDTH - 200, 20))
# Instructions
if not self.race_started:
start_text = "PRESS SPACE TO START!"
start_surface = self.font_medium.render(start_text, True, YELLOW)
start_rect = start_surface.get_rect(center=(SCREEN_WIDTH//2, 50))
self.screen.blit(start_surface, start_rect)
def draw_results(self):
self.screen.fill(BLACK)
# Title
title_text = "RACE RESULTS"
title_surface = self.font_large.render(title_text, True, YELLOW)
title_rect = title_surface.get_rect(center=(SCREEN_WIDTH//2, 80))
self.screen.blit(title_surface, title_rect)
# Results
for i, horse in enumerate(self.finish_order):
position_text = f"{i+1}. {horse.name}"
time_text = f"{horse.finish_time/1000.0:.2f}s"
# Position and name
pos_surface = self.font_medium.render(position_text, True, horse.color)
self.screen.blit(pos_surface, (200, 150 + i * 40))
# Time
time_surface = self.font_medium.render(time_text, True, WHITE)
self.screen.blit(time_surface, (450, 150 + i * 40))
# Instructions
restart_text = "PRESS SPACE FOR NEW RACE"
restart_surface = self.font_medium.render(restart_text, True, GREEN)
restart_rect = restart_surface.get_rect(center=(SCREEN_WIDTH//2, 500))
self.screen.blit(restart_surface, restart_rect)
menu_text = "PRESS M FOR MENU"
menu_surface = self.font_medium.render(menu_text, True, CYAN)
menu_rect = menu_surface.get_rect(center=(SCREEN_WIDTH//2, 540))
self.screen.blit(menu_surface, menu_rect)
def draw(self):
if self.game_state == "menu":
self.draw_menu()
elif self.game_state == "racing":
self.draw_racing()
elif self.game_state == "results":
self.draw_results()
pygame.display.flip()
def handle_events(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
return False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
return False
elif event.key == pygame.K_SPACE:
if self.game_state == "menu":
self.game_state = "racing"
elif self.game_state == "racing" and not self.race_started:
self.start_race()
elif self.game_state == "results":
self.create_horses()
self.start_race()
elif event.key == pygame.K_r:
self.create_horses()
self.game_state = "menu"
self.race_started = False
self.race_finished = False
elif event.key == pygame.K_m and self.game_state == "results":
self.game_state = "menu"
self.race_started = False
self.race_finished = False
return True
def run(self):
running = True
while running:
running = self.handle_events()
self.update()
self.draw()
self.clock.tick(FPS)
pygame.quit()
sys.exit()
if __name__ == "__main__":
game = Game()
game.run()
This retro horse racing game captures that classic 80's arcade feel with:
Visual Features:
- Bright, contrasting colors typical of 80's arcade games
- Simple pixel-art style horses with animated legs
- Classic green grass track with white lane markers
- Checkered finish line pattern
- Retro-style text with multiple color layers for the title
Gameplay Features:
- 8 horses with different colors and names (Thunder, Lightning, Storm, etc.)
- Each horse has randomized speed and stamina attributes
- Realistic racing mechanics with speed variations and stamina effects
- Real-time position tracking and timing
- Three game states: menu, racing, and results
Controls:
- SPACE: Start race (from menu or racing screen)
- R: Restart/return to menu
- M: Return to menu (from results)
- Q: Quit game
80's Arcade Elements:
- High contrast color palette
- Simple geometric shapes for graphics
- Retro