Create a retro-themed, frog arcade game in Python. The game design looks like it could…
- User
Create a retro-themed, frog arcade game in Python. The game design looks like it could have been played in an arcade back in the 80's. Do not rely on external file uploads and instead create your own assets and designs.
Assistant
Sure! Below is a retro-themed arcade-style frog game written in Python using Pygame, designed to look like it could have come from the 80s. This game features:
- Pixel art style (created procedurally, no external assets)
- Retro color palette
- Arcade-style gameplay: help the frog cross the road or river
- Simple controls and collision detection
🐸 Frogger-Inspired Retro Game – Python + Pygame
✅ Requirements:
- Python 3.x
pygamemodule (pip install pygame)
🕹️ Game Description:
The player controls a frog trying to cross a busy road (or river with logs). The goal is to reach the top without getting hit by cars (or falling into water).
📜 Full Code:
import pygame import random import sys # Initialize Pygame pygame.init() # Constants SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 TILE_SIZE = 40 FPS = 60 # Colors (retro palette) BLACK = (0, 0, 0) GREEN = (20, 150, 20) DARK_GREEN = (10, 80, 10) WHITE = (255, 255, 255) YELLOW = (255, 230, 0) RED = (200, 0, 0) BLUE = (0, 50, 150) GRAY = (60, 60, 60) BROWN = (100, 60, 20) # Create screen screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) pygame.display.set_caption("Frog Hop - 80's Edition") clock = pygame.time.Clock() # Load sounds (if available) - optional # Game Objects class Frog(pygame.sprite.Sprite): def __init__(self): super().__init__() self.image = pygame.Surface((TILE_SIZE, TILE_SIZE)) self.image.fill(GREEN) # Draw simple frog face pygame.draw.circle(self.image, BLACK, (10, 10), 5) pygame.draw.circle(self.image, BLACK, (30, 10), 5) self.rect = self.image.get_rect() self.reset() def reset(self): self.rect.centerx = SCREEN_WIDTH // 2 self.rect.bottom = SCREEN_HEIGHT - 10 def update(self, keys): old_pos = self.rect.copy() if keys[pygame.K_UP]: self.rect.y -= TILE_SIZE elif keys[pygame.K_DOWN]: self.rect.y += TILE_SIZE elif keys[pygame.K_LEFT]: self.rect.x -= TILE_SIZE elif keys[pygame.K_RIGHT]: self.rect.x += TILE_SIZE # Keep within bounds if self.rect.left < 0: self.rect = old_pos if self.rect.right > SCREEN_WIDTH: self.rect = old_pos if self.rect.top < 0: self.rect = old_pos if self.rect.bottom > SCREEN_HEIGHT: self.rect = old_pos class Car(pygame.sprite.Sprite): def __init__(self, y, direction, speed): super().__init__() self.image = pygame.Surface((TILE_SIZE * 2, TILE_SIZE)) self.image.fill(RED if random.random() < 0.5 else BLUE) self.rect = self.image.get_rect() self.direction = direction self.speed = speed self.rect.y = y if direction == "left": self.rect.x = SCREEN_WIDTH else: self.rect.x = -TILE_SIZE * 2 def update(self): if self.direction == "left": self.rect.x -= self.speed if self.rect.right < 0: self.rect.left = SCREEN_WIDTH else: self.rect.x += self.speed if self.rect.left > SCREEN_WIDTH: self.rect.right = 0 # Background tiles def draw_background(): screen.fill(DARK_GREEN) for row in range(1, SCREEN_HEIGHT // TILE_SIZE): y = row * TILE_SIZE if row <= 2: color = GRAY elif row <= 5: color = BROWN else: color = DARK_GREEN pygame.draw.rect(screen, color, (0, y, SCREEN_WIDTH, TILE_SIZE), 0) # Main game function def main_game(): all_sprites = pygame.sprite.Group() cars = pygame.sprite.Group() frog = Frog() all_sprites.add(frog) # Spawn cars for i in range(3): lane_y = TILE_SIZE * (i + 1) direction = "left" if i % 2 == 0 else "right" speed = random.randint(2, 4) car = Car(lane_y, direction, speed) all_sprites.add(car) cars.add(car) running = True won = False font = pygame.font.SysFont("Courier New", 30, bold=True) while running: clock.tick(FPS) keys = pygame.key.get_pressed() for event in pygame.event.get(): if event.type == pygame.QUIT: running = False all_sprites.update(keys) # Check collision if pygame.sprite.spritecollideany(frog, cars): frog.reset() # Check win condition if frog.rect.top <= 0: won = True running = False # Draw everything draw_background() all_sprites.draw(screen) if won: win_text = font.render("YOU MADE IT!", True, YELLOW) screen.blit(win_text, (SCREEN_WIDTH//2 - win_text.get_width()//2, SCREEN_HEIGHT//2)) pygame.display.flip() pygame.time.wait(2000) return won # Start screen def show_start_screen(): screen.fill(BLACK) font = pygame.font.SysFont("Courier New", 36, bold=True) title = font.render("FROG HOP!", True, GREEN) prompt = font.render("Press SPACE to Play", True, WHITE) screen.blit(title, (SCREEN_WIDTH//2 - title.get_width()//2, SCREEN_HEIGHT//2 - 50)) screen.blit(prompt, (SCREEN_WIDTH//2 - prompt.get_width()//2, SCREEN_HEIGHT//2 + 10)) pygame.display.flip() waiting = True while waiting: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE: waiting = False # Main loop def main(): while True: show_start_screen() result = main_game() if not result: print("Game over, restarting...") if __name__ == "__main__": main()
🎮 Controls:
- Arrow Keys: Move the frog
- Spacebar: Start the game
🧠 Features:
- Retro pixel-style visuals created programmatically.
- Three lanes of traffic moving in alternating directions.
- Collision detection resets the frog.
- Winning condition: reaching the top.
🖼️ Visual Style:
- 40x40 pixel tile grid
- Hand-drawn sprites using basic shapes
- Color palette inspired by early 80s arcade games
Would you like to add sound effects, multiple levels, or logs on water next?
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.