Ball Collector (Peggle-Like)
Autumn 2023
In this project, I aimed to practice my Unity skills to create a small but finished game and generate a build for mobile. I made use of Unity's iOS app, which can stream mobile builds to a phone for testing touch controls and resolution scaling.
Key Features
- Level Generation: Each tier of difficulty maps to different stats when generating a level. Each tier affects the probability of black balls (negative points), purple balls (extra points), and the number and size of the balls within the play area.
- Mobile Controls: The original controls used the mouse, where the firing stick always pointed at the cursor and fired on click. You could only fire again once there were no active balls left. Later, a check was added for the mobile platform, which changed the controls to point at a touch position held down and fire upon releasing this touch.
- Scoring System: The scoring system adds up the balls collected in the moving bucket at the bottom of the level. Purple balls are worth more than orange ones, and black balls deduct points. However, your score cannot drop below zero at any time.
Challenges, solutions and lessons learnt
The main challenge was the physics between the bucket and the falling balls because I couldn't rely solely on the default rigidbody physics. This was because I wanted the balls to move along a fixed sine wave path, while rigidbody physics is based on applied forces. To achieve my final result, I made the bucket use regular rigidbody physics, but it mimicked the desired sine wave movement. I achieved this by tracking the desired sine wave position over time and accelerating the bucket towards that point. To achieve the desired result below, it required a lot of testing with different parameters to maintain smooth movement resembling a sine wave without applying too much force that would send colliding balls flying.
Embedded Game
![](../Games/BallCollector/Preview.png)