I'm trying to catch collisions between circular PNGs, but can't figure it out completely. I looked into using SVGs, and Tove looks like a decent library, but it isn't working for iOS.
What options do I have in correctly catching these collisions? The problem is that all vector PNGs still have some space outside of the actual image (which is the transparent part).
Is it possible to get Tove to work on iOS? Or are there simpler solutions?
This is the function I'm using to catch collisions (found it on this forum):
Code: Select all
function distance(x1, y1, x2, y2)
d = math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2)
return d
end
Code: Select all
if distance(x1, y1, x2, y2) - (radius1 + radius2) < 0 then
return true
end