Posted May 06, 2025 by Rheyan
In this devlog I start by refactoring my spawning code to improve the gameplay. I introduce a bug, finally fix it and then move onto audio. I build a simple audio manager to handle both sound effects and music in one centralised place.
Gameplay Refactoring & Spawning
🔄 PrefabSpawner class
Simplified FoodManager and ObstacleManager into a single spawner system
ObstacleManager uses two spawners (top/bottom); FoodManager uses one
Spawns items within a configurable range to avoid overlaps
🐞 Overlap bug & fix
Initial bug: items spawn overlapping due to collider instantiation timing
Added double-check parameter: runs a delayed coroutine (0.5 s) to re–detect overlaps
Some items still despawn “overfixing,” but major bug resolved
Audio Implementation
🔊 AudioManager setup
Centralized sound control via an AudioManager class (event-driven)
Separate AudioSources for music and SFX
Hard-coded clips for now; plans to refactor for scale
🎵 Music selection & looping
Sourced free loops from Itch.io (Tallbeard Studios)
Used same track for menu & gameplay; menu version is a slowed, shorter loop
⏳ Scene persistence & transitions
Applied Don’t Destroy on Load to persist AudioManager across scenes
Implemented fade-in coroutine (1.5 s) for smooth music transitions
🔈 Volume & event handling
Fine-tuned jump SFX volume per clip to avoid affecting all SFX
Current issue: both “hit obstacle” and “game over” events fire together—needs event filtering
Development Notes
📚 Progress slowed after core Flappy Bird mechanics—reliant on custom tutorials for refactoring, audio, and polishing features.