Back to Gravity Drift

README

ASTEROIDS

A classic arcade-style space shooter built with Kotlin and Jetpack Compose for Android.

🎮 Game Description

Navigate your ship through space, destroying asteroids and surviving through increasingly difficult levels. Experience classic arcade gameplay with modern graphics and smooth 60 FPS performance.

✨ Features

  • Ship-Centered Gameplay - Ship stays centered while the universe moves around you
  • Progressive Levels - Complete levels by destroying all asteroids, difficulty increases each level
  • Asteroid Physics - Asteroids break into smaller pieces when shot
  • Explosive Effects - Orange particle explosions on asteroid destruction
  • 3-Layer Parallax Starfield - Depth-creating background with different scroll speeds
  • Mini Map - 250x250px radar showing nearby asteroids
  • Smooth Controls - Custom hold-button system for responsive ship control
  • Full Portrait Mode - Optimized for mobile gameplay

🚀 Technical Highlights

  • Native Android - Built with Kotlin for maximum performance
  • Jetpack Compose Canvas - Modern declarative UI for custom rendering
  • 60 FPS Game Loop - Smooth gameplay with 16ms frame updates
  • Screen Wrapping - Seamless world boundaries
  • Collision Detection - Accurate bullet-asteroid collision with radius-based detection

🎯 Controls

Bottom Left:

  • Rotation Slider - DJ mixer style fader control
- Drag left for left rotation (up to 180°) - Center position = ship pointing straight up - Drag right for right rotation (up to 180°) - Automatically centers when released

Bottom Right:

  • Thrust Button (↑) - Fire engines to move forward
  • Fire Button (🔥) - Shoot bullets

🛠️ Technology Stack

  • Language: Kotlin
  • UI Framework: Jetpack Compose
  • Build System: Gradle with Version Catalogs
  • Min SDK: 26 (Android 8.0)
  • Target SDK: 35 (Android 14)

📊 Game Mechanics

  • Ship stays centered, world moves relative to ship
  • Asteroids spawn from screen edges
  • Large asteroids split into 2 smaller pieces when hit
  • Score increases with each asteroid destroyed
  • 10 progressive levels with increasing difficulty:
- More asteroids per level - Faster asteroid speeds (20% speed increase per level)
  • Lives system (3 lives)
  • Level system with wave-based progression

🎨 Visual Features

  • Gradient space backgrounds
  • 3-layer parallax stars (165 total) with truly random positions
- Layer 1: 50 dim purple stars (slowest) - Layer 2: 75 medium blue stars (medium speed) - Layer 3: 40 bright white stars (fastest)
  • Procedurally generated asteroid shapes (8-12 sided polygons)
  • Neon glow effects on ship and asteroids
  • Color-coded controls:
- Blue DJ mixer-style rotation slider with vertical fader handle - Orange thrust button - Pink fire button
  • Real-time mini map overlay (250x250px) showing asteroid positions
  • Explosion particle effects

📱 Building the Game

bash
cd /home/jon/AndroidStudioProjects/MyApplication2
./gradlew assembleDebug

📦 Installation

bash
adb -s <DEVICE_ID> install -r app/build/outputs/apk/debug/app-debug.apk
adb -s <DEVICE_ID> shell am start -n com.example.myapplication/.MainActivity

🎮 Gameplay Tips

  • Keep moving - stationary targets are easier to hit
  • Rotate before thrusting to control direction
  • Break large asteroids first for easier cleanup
  • Watch the mini map for incoming asteroids
  • Clear all asteroids to advance to the next level
  • 📈 Version History

    • v2.1 - DJ Mixer Controls & Random Stars
    - Replaced left/right buttons with DJ mixer-style rotation slider - Direct angle control (slider position = ship angle, ±180°) - Vertical fader handle with center line indicator - Truly random star positions (165 stars across 3 layers) - Auto-centering when slider released
    • v2.0 - Complete game redesign to Asteroids
    - 3-layer parallax stars - Larger mini map (250px) - Improved collision detection - Level progression system - Enhanced button styling with colors - Homepage intro text
    • v1.0 - Initial Gravity Drift (previous game)

    🎯 Future Enhancements

    • [ ] Enemy ships that shoot back
    • [ ] Power-ups (shields, rapid fire, spread shot)
    • [ ] High score leaderboard
    • [ ] Sound effects and music
    • [ ] Particle trails for bullets
    • [ ] Ship destruction animation
    • [ ] Bonus levels
    • [ ] Multiple ship types with different stats

    📄 License

    Created for personal use and learning.

    🙏 Credits

    Inspired by the classic arcade game "Asteroids" (1979) by Atari. Rebuilt from scratch in native Android/Kotlin using Jetpack Compose.


    Current Version: 2.1 Last Updated: 2025-10-07

    © 2026 Jonathan Leahy · v1.0.11