[quote="Citnarf":2mxw9qb2][quote="Smilex":2mxw9qb2]You can go with the random() option, but the most common ( at least that I've seen in games ), is doing like most humans do, target the closest one.
To do this you could use pythagoras ( a^2 * b^2 = c^2 ), where a = object.X - target.X
and b = object.Y - target.Y
, do this to find the distance between all the targets ( on screen or whatever ) and check for which distance is the shortest. If some distances are equal, just take the first one or run the test again, considering the chances that something has moved.
There might be a better way, but this idea popped into my head. Can't really consider it much though, as I am in class.[/quote:2mxw9qb2]
You can do that a bit easier with the Distance(x1,y1,x2,y2) expression.
lol yeah, I guessed there was one of those around
Just started using Construct last night, so havn't really got around it much