Space Shooter -- Infinite Survival Game Upgrade by Andrea CestelliSpace Shooter -- Infinite Survival Game Upgrade by Andrea Cestelli

Space Shooter -- Infinite Survival Game Upgrade

Andrea Cestelli

Andrea Cestelli

Space Shooter -- Infinite Survival v2.1

A 2D arcade shooter inspired by Space Invaders, developed in Python with Pygame.
By: Ceccariglia Emanuele & Andrea Cestelli -- ITSUmbria 2026

Requirements

Dependency Minimum version Install Python 3.10+ python.org Pygame 2.0+ pip install pygame Pillow 9.0+ pip install Pillow

Quick Start

# Install dependencies
pip install pygame Pillow

# Launch the game
python main.py

Building a Standalone Executable (PyInstaller)

pip install pyinstaller

pyinstaller --onefile --windowed \
--add-data "assets:assets" \
--name "SpaceShooter" \
main.py

The game automatically resolves asset paths when running from a PyInstaller bundle (via sys._MEIPASS). The save file (save_data.json) is written next to the executable so it persists across runs.

Controls

Key Action W / Arrow Up Move up S / Arrow Down Move down A / Arrow Left Move left D / Arrow Right Move right SPACE Shoot B Use bomb F Special ability (EMP / Overdrive) P / ESC Pause / Resume ENTER Confirm selection A / D Choose ship (ship select screen)

Ships (5 playable)

Five animated ships, each with unique stats and abilities. The last two have a double cannon.
# Name Cannon Special Unlock 0 Viper Single None Default 1 Phoenix Single HP Regeneration 200 pts 2 Striker Single Piercing lasers 500 pts 3 Nova Double EMP (key F) 1 000 pts 4 Zenith Double Overdrive (key F) 2 000 pts

Ship Stats

Ship Speed Fire Rate Damage Special Viper 1.0x 1.0x 1 Balanced, no special Phoenix 0.8x 1.3x (slow) 2 Regen 1 HP every 15 s Striker 1.4x 0.6x (fast) 1 Lasers pierce through enemies Nova 1.1x 0.85x 1 EMP: clears enemy lasers Zenith 0.9x 1.0x 2 Overdrive: rapid fire for 5 s

Special Ability Cooldown Bar

Ships with an active special ability (Phoenix / Nova / Zenith) display a cooldown bar directly below the ship sprite during gameplay. The bar fills from left to right:
Green = fully charged / ready
Yellow = more than half charged
Orange = still recharging

Enemies (4 animated types)

Type HP Points Fire pattern Scout 1 1 Fast single laser Fighter 2 3 Double parallel lasers Bomber 4 5 Slow triple parallel Elite 3 8 Rapid 3-burst

Intelligent Formations

Formations contain mixed types: scouts in the front rows, bombers and elites in the back. 18 formation patterns are available, chosen with an anti-repetition system.

Hit Feedback (multi-HP enemies)

Shake: rapid sprite oscillation
Mini-explosion: animated impact flash
HP bar: shows remaining health

Boss Fight (4 variants)

Each boss has a unique animated GIF and an exclusive fire pattern that is challenging but always dodgeable with good positioning.
# Name Pattern 0 Titan Alternating dual-cannon volleys (straight / converging) 1 Fury Staggered 3-shot bursts alternating left and right 2 Fanblaze Slow sweeping pendulum -- 3 parallel lasers sweep side to side 3 Vortex Double helix -- two opposite spiral arms at constant speed

Progressive Scaling

Each successive boss gets stronger:
+10 HP per boss defeated
+0.3 horizontal speed
-4 frames shoot interval (min 22)
Increasing score bonus

Game Mechanics

Combo System

Kill enemies in rapid succession to build combos:
3+ kills: combo visible
Score multiplier: +50 %, +100 %, +150 %, +200 %, +300 %
Floating damage numbers on screen

Bombs

Collect from the Bomb power-up (max 3)
Destroys ALL enemies on screen and clears enemy lasers
Deals 25 % of the boss's remaining HP
2-second cooldown between uses

Slow Motion

Activates automatically after a boss defeat
Slows the action for a dramatic moment

Lives & Protection

3 maximum lives
Temporary invincibility after each hit
Shield absorbs hits and protects from damage
Asteroid with shield: shield breaks, no HP loss
Asteroid without shield: instant death

Power-Ups

Power-ups are carried by carrier ships that descend and hover for 5 seconds.
Type Effect Duration Health Restore 1 heart (max 3) Instant Shield Absorb incoming hits 5 seconds Speed Speed boost x1.8 5 seconds Weapon Triple / quad angled shot 5 seconds Bomb +1 bomb (max 3) Permanent

Formations (18 patterns)

Randomly chosen with anti-repetition:
H_LINE_3, H_LINE_5, V_LINE_3, GRID_3x2, GRID_4x2, GRID_3x3, DIAMOND, V_SHAPE, CROSS, T_SHAPE, STAGGER_3x2, PINCER, ARROW, Z_LINE, WING, CHEVRON, FORTRESS, X_SHAPE

Asteroids

Fall vertically with a luminous trail (animated spritestrip)
Indestructible by lasers
Collision without shield = instant death
Shield absorbs ONE asteroid hit

Asteroid Rain

Periodic special event:
3-second warning with flashing orange overlay
Asteroids rain down for 20--40 seconds
Guaranteed safe corridor: at least 100 px clear

Progressive Difficulty

Every 30 seconds the difficulty increases (max level 10):
Enemies +12 % speed per level
Shorter spawn intervals
More enemies per wave
More complex formations
Stronger enemy types unlocked

Audio

All sounds -- including the background music -- are generated procedurally at runtime without any external audio files.

Save System

The game auto-saves to save_data.json:
All-time high score
Top 10 scores
Unlocked ships (progressive unlock)
Cumulative stats (playtime, kills, bosses defeated)
Automatic migration from earlier save formats is supported.

Project Structure

SpaceShooter/
|-- main.py # Entry point
|-- save_data.json # Auto-save file (created at runtime)
|-- .gitignore
|-- README.md
|
|-- core/ # Shared infrastructure
| |-- __init__.py
| |-- assets.py # Centralised asset loader (GIF/PNG -> Pygame)
| |-- constants.py # Global constants (ships, bosses, colours, fonts)
| |-- save_manager.py # JSON save / load / migration (PyInstaller-safe)
| +-- sounds.py # Procedural audio + background music
|
|-- entities/ # Game entities
| |-- __init__.py
| |-- player.py # Player ship (5 ships, animated, abilities)
| |-- enemy.py # Enemy with animated GIF sprite + shake
| |-- boss.py # Boss with 4 variants + unique dodgeable patterns
| |-- asteroid.py # Asteroid with safe-corridor logic
| |-- laser.py # Straight / angled laser projectiles
| |-- powerup.py # Carrier + falling power-up items
| |-- explosion.py # Animated explosion from GIF
| |-- formations.py # 18 formations with anti-repetition
| +-- formation_group.py # Enemy group with mixed types (weak front)
|
|-- game/
| |-- __init__.py
| +-- game.py # Game loop, states, spawning, collisions, HUD
|
|-- world/
| |-- __init__.py
| +-- starfield.py # 3-layer parallax star field
|
+-- assets/ # Sprites (PNG and GIF)
|-- ships/ # Player ship spritesheets
|-- enemies/ # Enemy spritesheets
|-- bosses/ # Boss animated GIFs (4 variants)
|-- lasers/ # 66 laser sprite variants
|-- powerups/ # Carrier + power-up sprites
|-- sprites/ # Asteroids and trails
+-- effects/ # Explosion GIF
Developed with Python 3 / Pygame / Pillow -- ITSUmbria 2026

Summary

Complete overhaul of Space Shooter -- Infinite Survival addressing text sizing, boss patterns, special ability UI, performance, PyInstaller compatibility, bug fixes, and code quality.

Changes Made

1. Text & UI Sizes

Centralized all font sizes in constants.py for easy tuning
Adjusted all screens (menu, ship select, HUD, pause, game-over, credits) for 800×600
Added dedicated smaller fonts for ship card details to prevent text overflow

2. Boss Laser Patterns (Redesigned)

All 4 boss attack patterns are now unique, simple to read, and always dodgeable:
Boss Old Pattern New Pattern Titan Rotating cannons (confusing) Alternating dual-cannon volleys (straight + converging) Fury Devastating bursts + auto fire Staggered 3-shot bursts alternating left/right Fanblaze 7-ray fan (undodgeable) Slow pendulum sweep -- 3 parallel lasers Vortex 3 accelerating spirals Double helix -- 2 arms at constant speed

3. Special Ability Cooldown Bar

New cooldown bar rendered below the player ship for EMP / Overdrive / Regen ships
Color transitions: orange → yellow → green as it recharges
Shows "READY" state clearly

4. Performance Improvements

Pre-allocated reusable surfaces (_shake_surf, _overlay_surf)
convert_alpha() on all asset loading
Reduced per-frame Surface allocations

5. PyInstaller Compatibility

resource_path() resolves assets via sys._MEIPASS
Save file writes beside executable, not inside temp dir
README includes build instructions
_on_boss_defeated() None access guard
EMP starts ready (emp_ready=True)
Regen timer resets at full HP
JSON encoding + KeyError handling
Safe deep-copy of default save data

7. Code Refactoring

English docstrings on all functions
Consistent formatting
Updated README to v2.1
.gitignore updated for PyInstaller builds

Testing

All 16 source files compile successfully
Full import and functional test passes
Boss patterns verified: Titan=2 lasers, Fanblaze=3 lasers, Vortex=2 lasers
Player special properties tested for all 5 ship types
Like this project

Posted Mar 25, 2026

Upgraded Space Shooter game with enhanced UI, boss patterns, and performance.