On Android, I use SurfaceView to display a simple 2D game. Bitmaps (.png) with alpha (representing game objects) are drawn on canvas.
Now I would like to make a simple but accurate collision detection. Checking if these bitmaps overlap is pretty simple.
But how can I check for conflicts when these bitmaps have transparent areas? My task is to determine whether two balls collide or not. They fill the entire raster map in width and height, but, as in all four edges, there are transparent areas, of course, since this is a circle in a square.
What is the easiest way to detect collisions there, only if the balls really collide, and not their surrounding raster frame?
Should I store the coordinates of as many points as possible on the contour of the ball? Or can Android “ignore” the alpha channel when checking for conflicts?
source
share