Create a retro-themed, bug arcade game in Pygame. The game design looks like it could…
- User
Create a retro-themed, bug arcade game in Pygame. 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
I'll create a retro 80s-style arcade game called "Bug Blaster" using Pygame with all assets created programmatically. Here's the complete game:
import pygame import random import math import sys # Initialize Pygame pygame.init() # Constants SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 FPS = 60 # Colors (80s arcade palette) BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) YELLOW = (255, 255, 0) CYAN = (0, 255, 255) MAGENTA = (255, 0, 255) ORANGE = (255, 165, 0) BLUE = (0, 100, 255) DARK_GREEN = (0, 150, 0) class Player: def __init__(self, x, y): self.x = x self.y = y self.width = 40 self.height = 30 self.speed = 5 self.color = GREEN self.shoot_cooldown = 0 def draw(self, screen): # Draw beetle-like player # Body pygame.draw.ellipse(screen, self.color, (self.x - self.width//2, self.y - self.height//2, self.width, self.height)) pygame.draw.ellipse(screen, DARK_GREEN, (self.x - self.width//2 + 5, self.y - self.height//2 + 5, self.width - 10, self.height - 10)) # Head pygame.draw.circle(screen, self.color, (self.x, self.y - self.height//2 - 5), 8) # Antennae pygame.draw.line(screen, WHITE, (self.x - 5, self.y - self.height//2 - 5), (self.x - 10, self.y - self.height//2 - 15), 2) pygame.draw.line(screen, WHITE, (self.x + 5, self.y - self.height//2 - 5), (self.x + 10, self.y - self.height//2 - 15), 2) def move_left(self): self.x = max(self.width//2, self.x - self.speed) def move_right(self): self.x = min(SCREEN_WIDTH - self.width//2, self.x + self.speed) def update(self): if self.shoot_cooldown > 0: self.shoot_cooldown -= 1 class Bullet: def __init__(self, x, y): self.x = x self.y = y self.width = 4 self.height = 10 self.speed = 8 self.color = YELLOW def draw(self, screen): pygame.draw.rect(screen, self.color, (self.x - self.width//2, self.y - self.height//2, self.width, self.height)) # Add glow effect pygame.draw.rect(screen, WHITE, (self.x - 1, self.y - self.height//2, 2, 4)) def update(self): self.y -= self.speed def is_off_screen(self): return self.y < 0 class Bug: def __init__(self, x, y, bug_type): self.x = x self.y = y self.bug_type = bug_type self.frame = 0 self.animation_speed = 0.2 if bug_type == "fly": self.width = 20 self.height = 20 self.speed = 2 self.color = BLACK self.points = 10 self.hp = 1 elif bug_type == "mosquito": self.width = 15 self.height = 25 self.speed = 3 self.color = RED self.points = 20 self.hp = 1 elif bug_type == "spider": self.width = 30 self.height = 30 self.speed = 1 self.color = MAGENTA self.points = 30 self.hp = 2 elif bug_type == "wasp": self.width = 25 self.height = 20 self.speed = 4 self.color = YELLOW self.points = 40 self.hp = 1 self.horizontal_speed = random.uniform(-1, 1) def draw(self, screen): self.frame += self.animation_speed if self.bug_type == "fly": # Draw fly body pygame.draw.ellipse(screen, self.color, (self.x - self.width//2, self.y - self.height//2, self.width, self.height)) # Wings (animated) wing_offset = int(math.sin(self.frame) * 5) pygame.draw.ellipse(screen, WHITE, (self.x - self.width - wing_offset, self.y - 5, 15, 10)) pygame.draw.ellipse(screen, WHITE, (self.x + self.width//2 + wing_offset - 5, self.y - 5, 15, 10)) elif self.bug_type == "mosquito": # Draw mosquito body pygame.draw.ellipse(screen, self.color, (self.x - 5, self.y - self.height//2, 10, self.height)) # Proboscis pygame.draw.line(screen, self.color, (self.x, self.y + self.height//2), (self.x, self.y + self.height//2 + 8), 2) # Wings wing_flap = int(math.sin(self.frame * 2) * 3) pygame.draw.ellipse(screen, WHITE, (self.x - 10 - wing_flap, self.y - 5, 8, 6)) pygame.draw.ellipse(screen, WHITE, (self.x + 2 + wing_flap, self.y - 5, 8, 6)) elif self.bug_type == "spider": # Draw spider body pygame.draw.circle(screen, self.color, (self.x, self.y), 12) pygame.draw.circle(screen, self.color, (self.x, self.y - 8), 8) # Draw legs leg_move = math.sin(self.frame) * 2 for i in range(4): angle = i * 40 - 60 end_x = self.x + math.cos(math.radians(angle)) * 20 end_y = self.y + math.sin(math.radians(angle)) * 15 + leg_move pygame.draw.line(screen, self.color, (self.x, self.y), (end_x, end_y), 2) end_x = self.x - math.cos(math.radians(angle)) * 20 pygame.draw.line(screen, self.color, (self.x, self.y), (end_x, end_y), 2) elif self.bug_type == "wasp": # Draw wasp body pygame.draw.ellipse(screen, BLACK, (self.x - self.width//2, self.y - self.height//2, self.width, self.height)) # Stripes for i in range(3): y_pos = self.y - self.height//2 + 5 + i * 6 pygame.draw.rect(screen, self.color, (self.x - self.width//2 + 2, y_pos, self.width - 4, 3)) # Wings wing_beat = int(math.sin(self.frame * 3) * 4) pygame.draw.ellipse(screen, (200, 200, 200), (self.x - self.width + wing_beat, self.y - 8, 12, 6)) pygame.draw.ellipse(screen, (200, 200, 200), (self.x + self.width//2 - wing_beat - 4, self.y - 8, 12, 6)) def update(self): self.y += self.speed self.x += self.horizontal_speed # Keep bugs on screen horizontally if self.x < self.width//2 or self.x > SCREEN_WIDTH - self.width//2: self.horizontal_speed *= -1 self.x = max(self.width//2, min(SCREEN_WIDTH - self.width//2, self.x)) def is_off_screen(self): return self.y > SCREEN_HEIGHT + self.height def hit(self): self.hp -= 1 if self.hp <= 0: return True # Flash white when hit original_color = self.color self.color = WHITE return False class Explosion: def __init__(self, x, y, color): self.x = x self.y = y self.color = color self.radius = 5 self.max_radius = 30 self.growth_speed = 3 def draw(self, screen): if self.radius < self.max_radius: pygame.draw.circle(screen, self.color, (self.x, self.y), self.radius, 2) pygame.draw.circle(screen, WHITE, (self.x, self.y), self.radius//2, 1) def update(self): self.radius += self.growth_speed def is_finished(self): return self.radius >= self.max_radius class Game: def __init__(self): self.screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) pygame.display.set_caption("BUG BLASTER - 1984") self.clock = pygame.time.Clock() self.font = pygame.font.Font(None, 36) self.big_font = pygame.font.Font(None, 72) self.reset_game() def reset_game(self): self.player = Player(SCREEN_WIDTH // 2, SCREEN_HEIGHT - 50) self.bullets = [] self.bugs = [] self.explosions = [] self.score = 0 self.lives = 3 self.level = 1 self.bug_spawn_timer = 0 self.bug_spawn_delay = 60 self.game_over = False self.flash_timer = 0 def spawn_bug(self): x = random.randint(30, SCREEN_WIDTH - 30) y = -30 # Spawn different bugs based on level if self.level < 3: bug_types = ["fly", "mosquito"] elif self.level < 5: bug_types = ["fly", "mosquito", "spider"] else: bug_types = ["fly", "mosquito", "spider", "wasp"] bug_type = random.choice(bug_types) self.bugs.append(Bug(x, y, bug_type)) def check_collisions(self): # Check bullet-bug collisions for bullet in self.bullets[:]: for bug in self.bugs[:]: if (abs(bullet.x - bug.x) < bug.width//2 + bullet.width//2 and abs(bullet.y - bug.y) < bug.height//2 + bullet.height//2): if bug.hit(): self.score += bug.points self.explosions.append(Explosion(bug.x, bug.y, bug.color)) self.bugs.remove(bug) self.bullets.remove(bullet) break # Check bug-player collisions for bug in self.bugs[:]: if (abs(bug.x - self.player.x) < bug.width//2 + self.player.width//2 and abs(bug.y - self.player.y) < bug.height//2 + self.player.height//2): self.lives -= 1 self.explosions.append(Explosion(self.player.x, self.player.y, RED)) self.bugs.remove(bug) self.flash_timer = 30 if self.lives <= 0: self.game_over = True def draw_ui(self): # Score score_text = self.font.render(f"SCORE: {self.score:06d}", True, WHITE) self.screen.blit(score_text, (10, 10)) # Lives lives_text = self.font.render("LIVES:", True, WHITE) self.screen.blit(lives_text, (SCREEN_WIDTH - 200, 10)) for i in range(self.lives): x = SCREEN_WIDTH - 100 + i * 30 # Draw mini beetle pygame.draw.ellipse(self.screen, GREEN, (x, 15, 20, 15)) # Level level_text = self.font.render(f"LEVEL: {self.level}", True, WHITE) self.screen.blit(level_text, (SCREEN_WIDTH // 2 - 60, 10)) # Game over if self.game_over: game_over_text = self.big_font.render("GAME OVER", True, RED) text_rect = game_over_text.get_rect(center=(SCREEN_WIDTH//2, SCREEN_HEIGHT//2)) self.screen.blit(game_over_text, text_rect) restart_text = self.font.render("Press SPACE to play again", True, WHITE) text_rect = restart_text.get_rect(center=(SCREEN_WIDTH//2, SCREEN_HEIGHT//2 + 80)) self.screen.blit(restart_text, text_rect) def run(self): running = True while running: # Handle events for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: if self.game_over: self.reset_game() elif self.player.shoot_cooldown <= 0: self.bullets.append(Bullet(self.player.x, self.player.y - 20)) self.player.shoot_cooldown = 15 if not self.game_over: # Handle continuous input keys = pygame.key.get_pressed() if keys[pygame.K_LEFT] or keys[pygame.K_a]: self.player.move_left() if keys[pygame.K_RIGHT] or keys[pygame.K_d]: self.player.move_right() # Update game objects self.player.update() # Update bullets for bullet in self.bullets[:]: bullet.update() if bullet.is_off_screen(): self.bullets.remove(bullet) # Update bugs for bug in self.bugs[:]: bug.update() if bug.is_off_screen(): self.bugs.remove(bug) # Update explosions for explosion in self.explosions[:]: explosion.update() if explosion.is_finished(): self.explosions.remove(explosion) # Spawn bugs self.bug_spawn_timer += 1 if self.bug_spawn_timer >= self.bug_spawn_delay: self.spawn_bug() self.bug_spawn_timer = 0 # Check collisions self.check_collisions() # Level progression if self.score > self.level * 100: self.level += 1 self.bug_spawn_delay = max(20, 60 - self.level * 5) # Update flash timer if self.flash_timer > 0: self.flash_timer -= 1 # Draw everything if self.flash_timer > 0 and self.flash_timer % 4 < 2: self.screen.fill(RED) else: self.screen.fill(BLACK) # Draw grid pattern for retro effect for i in range(0, SCREEN_HEIGHT, 20): pygame.draw.line(self.screen, (20, 20, 20), (0, i), (SCREEN_WIDTH, i), 1) for i in range(0, SCREEN_WIDTH, 20): pygame.draw.line(self.screen, (20, 20, 20), (i, 0), (i, SCREEN_HEIGHT), 1) # Draw game objects if not self.game_over or self.flash_timer <= 0: self.player.draw(self.screen) for bullet in self.bullets: bullet.draw(self.screen) for bug in self.bugs: bug.draw(self.screen) for explosion in self.explosions: explosion.draw(self.screen) self.draw_ui() # Update display pygame.display.flip() self.clock.tick(FPS) pygame.quit() sys.exit() # Run the game if __name__ == "__main__": game = Game() game.run()This "Bug Blaster" game features:
Retro 80s Arcade Elements:
- Bright, contrasting colors typical of CRT monitors
- Simple geometric shapes for sprites
- Grid background pattern for that classic arcade look
- Pixelated font style
- Score displayed with leading zeros (classic arcade style)
Gameplay Features:
- Control a beetle at the bottom that shoots upward
- Four different enemy bug types with unique behaviors:
- Flies: Basic enemies
- Mosquitoes: Faster, worth more points
- Spiders: Tougher enemies (2 HP), appear in later levels
- Wasps: Very fast, high point value
- Progressive difficulty with faster spawning as levels increase
- Lives system with visual indicators
- Screen flash effect when hit
- Explosion effects when bugs are destroyed
Controls:
- Arrow keys or A/D to move left/right
- Space to shoot
- 15-frame cooldown between shots
Visual Effects:
- Animated bug wings that flap
- Spider legs that move
- Explosion effects in bug colors
- Flash effect when player is hit
- All graphics created with pygame drawing functions (no external assets)
The game captures that classic 80s arcade feel with its simple but addictive gameplay, bright colors, and increasing difficulty curve!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.