Bubble Game
BubblePop Game is a native iOS casual arcade-style game developed using SwiftUI. Designed to test players' reflexes and hand-eye coordination, the game challenges users to pop randomly spawned bubbles within a set countdown timer to achieve the highest score possible.
The core gameplay features a dynamic bubble life-cycle and a strategic combo system. The game incorporates a 3-second initial countdown, after which bubbles spawn dynamically within a bounded area. To ensure clean visuals, the game utilizes a distance-checking anti-overlapping algorithm (calculating Euclidean distance and retrying up to 20 times per spawn). Bubbles are assigned random lifespans (1 to 3 seconds), staying fully opaque for the first half of their duration before smoothly fading to zero opacity. Strategically, popping consecutive bubbles of the same color rewards the player with a 1.5x score multiplier, accompanied by animated, floating score pop-ups (e.g. +1.5, +10.0) at the tap location.
Key Features:
- Anti-Overlapping Spawning Engine: Bubbles spawn dynamically without overlapping, verified in real-time using mathematical distance metrics.
- Weighted Probability Bubble Colors: Features 5 bubble types—Red (1 pt, 40%), Pink (2 pts, 30%), Green (5 pts, 15%), Blue (8 pts, 10%), and Black (10 pts, 5%)—distributed using cumulative probability.
- Smooth Fade-Out Mechanics: Driven by a high-frequency 0.1s timer that computes and renders smooth opacity transitions for bubbles.
- Color-Based Combo System: Tracks the color of the previously popped bubble to apply a 1.5x score multiplier for consecutive same-color matches.
- MVVM State & Navigation Flow: Implements clean separation of concerns using
ScoreViewModelto persist high scores and a customRouterManagerto coordinate transition states via SwiftUI's NavigationStack.
Key features & challenges
- Developed a dynamic anti-overlapping spawning engine using Euclidean distance math.
- Implemented a weighted probability system for 5 distinct bubble categories.
- Designed a same-color combo mechanic applying a 1.5x multiplier.
- Created smooth fade-out animations using a high-frequency Timer.
- Used SwiftUI NavigationStack with a centralized RouterManager pattern.