Last days I’ve spent some time making some tests with collision detection on Android. It could be easy to use the simple approach to test if two circles overlap on each frame using the simplest game loop:

while (playing)

But I’ve bought my phone for fun, to enjoy doing hard things :D or at least trying to make them in the good way. So I started to read about proper game loop design.

I must say it’s quite hard to find nice articles, most of them just present a buggy deltatime based model, but fortunately I found two very nice articles about it:

Regarding the collision detection I also found two articles, quite old but still useful: Pool Hall Lessons: Fast, Accurate Collision Detection Between Circles or Spheres and Simple Intersection Tests For Games

When you try to check on each frame if two objects collide, you could get into error very easy if the objects move at high speed. It happens if the distance they’ll move from one frame to another is bigger than the size of then so they just jump/pass through each other like a ghost :)

To prevent it I check the movement from the last frame to the current one to to see if the objects collide between the frames.