2 Players Hockey Ball Game on one Android mobile. Each player cannot exceed the middle line and prevent balls with different colors entering player’s gate. Squares in the middle circle represent scores. Balls are in various scale, color and they are randomly generated.
GitHub Link: https://github.com/BosonHBC/PumpIt
Java / Android Studio
I did all programming like the movement of balls, and the collision between balls. The size and the speed of balls mattered in collision so it was a complicated physic system.
The physic system was not initially imbeded in Java API, so I have to write my own collision system.
This is the function of playBallVsPlayBall(Playball pb); This function handle the collision between balls that moving in the table (not player). It simulates a real ball vs ball collision and follow the principle of conservation of momentum.