Sebuah game space shooter yang dibuat menggunakan PyGame untuk Learning by Example (LBE) course. Game ini menampilkan pesawat luar angkasa yang dapat menembak asteroid sambil menghindari tabrakan, dilengkapi dengan sistem powerup, health, high score, dan berbagai fitur canggih lainnya.
- Kontrol pesawat dengan WASD atau Arrow Keys
- Tembak asteroid dengan Space bar (dengan cooldown 0.25 detik)
- Hindari tabrakan dengan asteroid
- Sistem scoring berdasarkan asteroid yang dihancurkan
- Background music otomatis dengan sound effects
- Animasi ledakan saat asteroid hancur
- Resolusi game: 1000x700 pixel untuk pengalaman visual yang lebih baik
Game ini mendukung 2 jenis pesawat yang dapat dipilih di menu utama:
-
Blue Ship (Balanced Fighter)
- Kecepatan standard dan seimbang
- Pesawat ideal untuk pemain biasa
- Ukuran: 70x70 pixel
-
Red Ship (Fast Fighter)
- Kecepatan +1 lebih cepat dari Blue Ship
- Cocok untuk pemain yang suka bergerak cepat
- Ukuran: 70x70 pixel
Fitur Animasi Pesawat:
- 3 frame animasi untuk setiap pesawat (Frame_01, Frame_02, Frame_03)
- Animasi dinamis di menu selection dengan efek flip horizontal
- Arah pesawat berubah setiap 2 detik di menu
- 3 Health Points untuk setiap pesawat
- Visual Health Indicator: Ikon pesawat kecil (30x30) di kanan bawah
- Health icon menggunakan asset pesawat sesuai warna yang dipilih
- Game over setelah health habis
5 jenis powerup dengan efek unik:
-
โก Energy Powerup (Hijau)
- Menghancurkan semua musuh di layar sekaligus
- Bonus score +25 per musuh yang dihancurkan
- Efek visual: Multiple explosions
-
๐ Rocket Powerup (Merah)
- Duration: 10 detik
- Setiap musuh yang dihancurkan akan menembakkan 3 proyektil kecil
- Proyektil bergerak ke arah 225ยฐ, 270ยฐ, 315ยฐ (kiri-atas, atas, kanan-atas)
- Timer display: "Rocket: Xs"
-
๐ Health Powerup (Pink)
- Menambah 1 health point
- Maximum health: 3 points
- Restoration instant
-
๐ซ Ammo Powerup (Biru)
- Duration: 15 detik
- Menghilangkan shooting cooldown
- Bisa menembak dengan sangat cepat
- Timer display: "Ammo: Xs"
-
๐ก๏ธ Shield Powerup (Kuning)
- Duration: 8 detik
- Memberikan invincibility sementara
- Timer display: "Shield: Xs"
Sistem high score lengkap dengan persistensi data:
- Top 10 High Scores tersimpan permanent di
highscores.json - Input nama player otomatis setelah game over (jika score masuk top 10)
- High Scores menu di menu utama untuk melihat hall of fame
- Auto-sorting berdasarkan score tertinggi
- Real-time save setiap kali ada score baru
Menu Utama:
- Ship selection dengan preview animasi
- Play, High Scores, Options, Quit buttons
- UI yang clean dan responsive
Options Menu:
- Brightness Control: Slider untuk mengatur kecerahan (0-100%)
- Complete Controls Guide:
- Movement: WASD atau Arrow Keys
- Actions: SPACE (Shoot), P (Pause)
- Ship Selection: โ โ Arrow Keys (di menu)
- Pengaturan tersimpan selama sesi bermain
High Scores Menu:
- Display ranking, nama player, dan score
- Format: "1. PLAYER1 2,500"
- Navigation dengan ESC atau ENTER
- โ โ (panah kiri/kanan): Memilih jenis pesawat
- Mouse: Klik tombol Play/High Scores/Options/Quit
- ESC: Keluar dari game
- ESC atau ENTER: Kembali ke menu utama
- Mouse: Drag slider untuk mengatur brightness
- ESC atau Back button: Kembali ke menu utama
- WASD atau Arrow Keys: Gerakkan pesawat
- Space: Tembak peluru (cooldown 0.25 detik)
- P: Pause/Resume game
- ESC: Keluar ke menu utama
- Input Nama (jika high score): Type nama, ENTER save, ESC skip
- R: Restart game
- X: Kembali ke menu utama
- Type: Masukkan nama (max 15 karakter)
- ENTER: Simpan score dan nama
- ESC: Skip input nama
- BACKSPACE: Hapus karakter
- Python 3.7+
- PyGame 2.6.1+
- Clone atau download repository ini
- Install PyGame:
pip install pygame
- Jalankan game:
python game.py
PyGame_LBE25_Full/
โโโ game.py # Main file & state management
โโโ core.py # Game logic, classes, dan gameplay systems
โโโ menu.py # Menu system & UI components
โโโ highscore.py # High score management system
โโโ highscores.json # Persistent high scores data
โโโ README.md # Dokumentasi lengkap
โโโ Assets/ # Folder berisi semua asset game
โโโ Background Music.mp3
โโโ Destroyed.mp3 # Sound effect
โโโ PixelSpaceRage/
โโโ PixelBackgroundSeamless.png
โโโ 256px/ # Sprites: ships, asteroids, powerups, dll
- Ship Animations: 3-frame animation cycle untuk semua pesawat
- Menu Ship Preview: Animasi dinamis dengan directional flipping
- Explosion Effects: Multiple explosion types dan effects
- Powerup Visual Feedback: Timer displays untuk active powerups
- Health Visualization: Ship-colored health icons
- Brightness System: Real-time brightness adjustment
- Asteroid Management: Minimum 6 asteroids selalu di layar
- Auto-spawn System: Asteroid respawn setiap 2 detik jika kurang dari minimum
- Collision Detection: Circle collision untuk akurasi tinggi
- Shooting Cooldown: Preventing spam shooting (0.25s)
- State Management: MENU/OPTIONS/HIGHSCORES/PLAYING/PAUSED/GAME_OVER
- Persistent Settings: Brightness dan high scores tersimpan
- Asteroid destroyed: +50 points
- Powerup collected: +25 points
- Energy powerup bonus: +25 per enemy cleared
- Rocket projectile hits: +25 points
- High score threshold: Dynamic based on top 10
- Blue Ship: Ideal untuk pemula, movement terkontrol
- Red Ship: Untuk advanced players, speed advantage
- Health - Prioritas tertinggi untuk survival
- Shield - Temporary invincibility untuk situasi bahaya
- Energy - Instant screen clear dan bonus score
- Ammo - Untuk damage output maksimal
- Rocket - Additional damage dan score
- Manfaatkan Ammo powerup untuk maximum damage
- Gunakan Shield saat terlalu banyak asteroid
- Energy powerup optimal saat layar penuh asteroid
- Rocket effect memberikan additional projectiles
- Fokus pada survival untuk score jangka panjang
- Collect semua powerups untuk bonus points
- Energy powerup di saat yang tepat = massive bonus
- Ammo powerup + banyak asteroid = score boost
- Patience > aggressive playing untuk high scores
- โ Resolusi diperbesar ke 1000x700
- โ Health system dengan visual indicators
- โ 5 jenis powerup dengan efek unik
- โ High score system dengan input nama
- โ Shooting cooldown system
- โ Enhanced ship animations
- โ Comprehensive controls di Options
- โ Asteroid auto-spawn management
- โ Sound effects integration
Game ini dibuat untuk Learning by Example (LBE) PyGame course.
Assets:
- Graphics: PixelSpaceRage asset pack
- Background Music: Included in Assets folder
- Sound Effects: Destroyed.mp3
Development:
- Framework: PyGame 2.6.1
- Language: Python 3.11.9
- Development Environment: VS Code
๐ฎ Selamat bermain dan raih high score tertinggi! ๐