Random Gen.Cluster Problem

0 favourites
  • 11 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • Hi. In my game, I have a layout that randomly generates a map. BUT, for some reason, it all generates in one area, I want it spread out. This is what I have: <img src="http://dl.dropbox.com/u/61808535/Cool.png" border="0" /> So, what do I do?

  • I believe if you increase the size of your layout/margin then you can set them all to (random(width) and random(height. The layout of the items will be random, but otherwise you'd have to manually place them all and that's just a total bother.

  • Thanks! Is there any way I can make certain objects spawn randomly, but in certain formations?

  • Ahoy ! You forgot to put a range in your script

    You see , set all the random(1024) to random(0,1024) !

    Or I'll only spawn in 1024,1024

  • Ahoy ! You forgot to put a range in your script

    You see , set all the random(1024) to random(0,1024) !

    Or I'll only spawn in 1024,1024Is that any different from what I said? Not to sound mean, but it's a serious question. :)

  • Thanks! Is there any way I can make certain objects spawn randomly, but in certain formations?Do you mean like have trees spawn in a triangle formation, but randomly across the map? If you make another sprite with the same textures, but pre-set in that formation, you could have that sprite spawn in randomly like normal trees. I'm sure there are other ways, but that's what comes to mind. :) Hope that helped.

  • > Ahoy ! You forgot to put a range in your script

    > You see , set all the random(1024) to random(0,1024) !

    > Or I'll only spawn in 1024,1024Is that any different from what I said? Not to sound mean, but it's a serious question. :)

    Random require a min value and a max value. So yes it is different than what you said.

    random(0, 1024) will produce a number between 0 and 1023

    random(1024) will produce a number of 1024

    what your saying is set X to random(width), random(height). which will not solve the problem of items being placed in only one location

    random(0, width)

    random(0, height)

    You can also do a "repeat x" loop. So you don't need to create numerous "create tree" actions.

  • random(0, 1024) will produce a number between 0 and 1023

    random(1024) will produce a number of 1024

    What? No, that is incorrect. random(1024) is the same as random(0,1024)!

    If it were like you're saying, it would be a bug, because it would be the same as typing 1024.

  • By the way InvaderX... You should use loops when you repeat things

    +On start of layout
        +repeat 14 times
            -> create Tree on layer 1 at (random(1024),random(1024))
        +repeat 10 times
            -> create Wall on layer 1 at (random(1024),random(1024))
  • I did not know C2 had that! Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Fimbul , Oh Yeah ? Didn't know that !

    We are learning every day !

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