since u mention all those are moving parts, i assume u mange to declare the image location as x,y point
and if u are planning to make a game with this kind of stuff, i also assume that u have some sort of math background
so if u dont understand the stuff i am explaining below, well maybe u should move on to another project
so lets assume there are 2 stones in the screen moving, which their location of the center point of the image will be:
x1,y1
x2,y2
then simply, u need to define a size for the object, and lets define the size of:
stone1 radius = 5
stone2 radius = 10
then as what u are trying to do, is to know whether they overlap each other or not
because as u said, the location of the stone is constantly moving, so settimer will be good to use
so lets say u have a function to decide where the stones are, so u have x1,y1,x2,y2 values already. in the settimer function, u would like to have something like:
Code:
function:
x1_low :=x1-5
x1_up :=x1+5
y1_low :=y1-5
y1_up :=y1+5
x2_low :=x2-10
x2_up :=x2+10
y2_low :=y2-10
y2_up :=y2+10
if x1_low between %x2_low% and %x2_up%
if y1_low between %y2_low% and %y2_up%
msgbox, overlap
if x1_up between %x2_low% and %x2_up%
if y1_up between %y2_low% and %y2_up%
msgbox, overlap
if x1_low between %x2_low% and %x2_up%
if y1_up between %y2_low% and %y2_up%
msgbox, overlap
if x1_up between %x2_low% and %x2_up%
if y1_low between %y2_low% and %y2_up%
msgbox, overlap
return
ok as u can see, this is only a simple example using 4 corners to check whether they are overlap or not, so if u want it to be more accurate checking overlapping, more points define is required
anyhow, with only 2 stones and 4 points checking, there consist with 4 checking sets. if it is 3 stones and 4 points checking, there will consist with 12 checking sets. 5 stones 4 points = 40 sets equations...etc etc
the more stones u have, the slower it gets, as u can see in the concept, u need to check stone1 to stone2, stone3,....stoneN, and then check stone2 to stone3, stone4...stoneN...etc, like:
but of course with today's computer speed, even with 1000 calculation per second is good enough, and also very depends on ur refresh moving stones speed