Tresure Placement

This forum is currently in read-only mode.
  • I want to place a treasure chest on my island. Because my island is so irregularly shaped my various land sprites (Forest, River, Mountains, and plains) over lap into my solid border.

    I over exaggerated for this cap but want my treasure to be placed only on the island. Any suggestions?

    http://www.box.net/shared/3br9bj9rel

    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. Unless I make a start up screen and them move to the game island screen.

  • 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.

    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...

    + System: Start of layout
      + System: Repeat 1000 times
      + TreasureSprite: TreasureSprite overlaps BoundtySprite
        -> TreasureSprite: Set position to Random(640), Random(480)[/code:1jbp0dm5]
    
    [b]EDIT -[/b] 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.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • But isn't that the object of a while? To run until it its condition is satisfied?

    BTW what I meant about taking the while out is... I removed the while statement from the Start of layout. Strangely it works fine.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)