object placement comparisons

HI All,

I have a scene in a game where 8 frogs appear on the screen and I’ve written the code to have the frogs spread out. Once the frogs are in place I have 3 flowers appear on the screen and I want to make sure the flowers don’t overlap the frogs. Both objects have physics-“Kinematic” and have names. My question is this: Is there a way I can tell the flower to be at least 50px away from all frogs or do I have to write that statement for each frog individually? I.E.

if (flower1.x-frog1.x \< 50 or if flower1.x-frog1.x \> -50) or if (flower1.x-frog2.x \< 50 or if flower1.x-frog2.x \> -50) --or can I do something this? if (flower1.x-("frog").x \< 50 or if flower1.x -("frog").x \> -50)
or is there a better way?

Thanks for any advice [import]uid: 48122 topic_id: 22403 reply_id: 322403[/import]

You’d have to compare coords, yes.

Although a possible work around (depending on logic) might be to spawn them all dynamic and after a second switch to kinematic. (This should push any overlappers apart.)

Peach :slight_smile: [import]uid: 52491 topic_id: 22403 reply_id: 89399[/import]