Hi. I took a look at that cap. I can't think of a better way to do what you are trying to do, but I do know how to make it work.
I noticed that if I take the while out of the Start of Layout it runs fine but I do not want this using up resources.[/quote:1jbp0dm5]
Actually, it will only run once if you take the while out, so sometimes it would be placed incorrectly.
Anyway, I've noticed before that While doesn't act as I would expect. If you replace While with Repeat 1000 times it will work. It does not hurt to specify so many iterations, because once the overlapping condition is done, Construct will move on and not see that event again...
[code:1jbp0dm5]+ System: Start of layout
+ System: Repeat 1000 times
+ TreasureSprite: TreasureSprite overlaps BoundtySprite
-> TreasureSprite: Set position to Random(640), Random(480)[/code:1jbp0dm5]
EDIT - I might add, if the island in your main cap presents a small target for the random number generator, you should probably specify a significantly larger Repeat number in order to make sure to hit it.