Skip to content

About

Python based Missle Command clone

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Missile Command Clone

A Python/Pygame recreation of the classic 1980 Atari arcade game. Defend your city from a relentless barrage of incoming missiles by launching counter-missiles from your base. Difficulty increases over time as missiles spawn faster — see how long you can hold out.

Features

  • Click anywhere on screen to fire a defensive missile toward that point
  • Explosions chain-react and can intercept incoming missiles mid-flight
  • The city mixes residential, industrial and military buildings, destroyed by 3, 4 and 5 enemy missile impacts; your own explosions never harm the city, and a damaged building's health bar turns from green to yellow to red
  • Score tracks missile hits and survival time, with high score persistence
  • A wave counter next to the score goes up by one every 30 seconds of play, with a tick-tock sound on each wave change
  • Enemy missiles spawn faster over the first minute, then 10% more often after every further full minute of play
  • While the launcher's rapid-fire window is open, enemy missiles come twice as often
  • Enemy missiles leave a short exhaust trail that fades from orange to grey smoke
  • Enemy missiles aim anywhere across a standing building; one that misses the city hits the ground in a small blast that does no damage
  • Destroyed buildings erupt in a large, flickering red/orange/yellow fireball that fades out over the city

Requirements

  • Python 3.x
  • Pygame 2.x

Installation

  1. Clone or download this repository:

    git clone <repo-url>
    cd missile-command
  2. Install Pygame:

    pip install pygame

Running the Game

From the project root directory:

python3 main.py

Running tests

The test suite uses pytest, which is a dev-only dependency (the game itself only needs Pygame). Tests run headless; from the project root:

SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy uv run -q --no-project --python 3.13 --with pygame --with pytest python -m pytest -q

Or, with pygame and pytest installed in your environment, python -m pytest -q (tests/conftest.py sets the SDL dummy drivers itself). Tests never write the real config.json.

Controls

Input Action
Left Click Launch a defensive missile toward the cursor
SPACE (start screen) Start
ESC Pause / Resume
M Mute / unmute sound effects
SPACE (Game Over screen) Restart

Gameplay

Your launcher tower stands on the ground at the bottom centre of the screen, between the two halves of the city, and your missiles rise from its barrel. Enemy missiles fall from the top of the screen toward random points on your buildings along the bottom. An enemy missile that misses the city hits the ground and goes off in a small blast that does no damage. Click to fire a counter-missile — when it reaches the target point it explodes, destroying any incoming missiles caught in the blast radius. Each enemy missile destroyed by your explosion scores MISSILE_INTERCEPT_POINTS (10) points, and every full second survived scores 1. The bar under the launcher fills in orange while it reloads and turns yellow when it can fire again. An enemy missile that hits the launcher tower explodes and knocks the launcher offline for 3 seconds: it can't fire, its body turns grey with a red outline, and a hit while stunned restarts the stun. Every 60 seconds of play (at 1:00, 2:00, 3:00, ...) the launcher turns red for 10 seconds and can fire every 0.1 s, with a laser sound on each shot. The retro-style sound effects for launches, explosions, intercepts, city hits, wave changes and game over are generated in code from square waves and noise, with no audio files.

The game ends when all buildings are destroyed. Your final score and high score are displayed on the game over screen. Press SPACE to restart.

Press ESC during play to pause. The battlefield freezes and dims, and the pause screen lists the keys that work there: ESC to resume and M to mute or unmute.

About

Python based Missle Command clone

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

⌂ Proxy