ENDEU's Forum Posts

  • 3 posts
  • You just need the condition I mentioned trigger is used=false so it only picks from ones that are not used yet.

    Oh yes, I had misunderstood. Now everything is clear. Thank you very much for your help lionz!

  • To stop it picking the same one twice you can use a variable on 'trigger' to mark it as used, so then the above would be pick a random instance of 'trigger' where used=false : spawn 'collectible' and set used to true.

    The condition for spawning the collectibles worked perfectly, but as you lionz mentioned, there is still a chance that the collectible will spawn on the same trigger. I tried following your steps about the instance variable, but it still keeps spawning twice in the same trigger. I probably misunderstood something and ended up making a mistake. I'll send you the file if you'd like to take a look, I'd appreciate it.

    https://www.dropbox.com/scl/fi/2x2tw4uabjilutfnrgqtd/Trigger-Spawn-Test.capx?rlkey=jen63t79p14coq37k6udfi2e1&st=zw8uwskf&dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm creating a game in which, when I start the layout, I need exactly 9 collectibles to appear randomly in 9 of the 28 triggers scattered around the map.

    To consider:

    • Whenever the layout is started, the collectibles should appear in different locations. Therefore, their position should be randomly drawn at each layout start.

    • I created 28 triggers in total, all of which are copies. Each trigger is a sprite with a solid color, and these sprites are scattered all over the map. The collectibles should be placed on these triggers.

    • Exactly 9 collectibles need to appear, randomly positioned on 9 of the 28 triggers.

    In short, the idea is that, when the layout starts, the game draws 9 triggers out of the 28 that exist and places a collectible item on each of these 9 drawn triggers.

  • 3 posts