Issues with while loop

0 favourites
  • 3 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • [http://]imgur.com/C6LoiLJ

    i have events such that

    --> Object B.x = randomx

    --> Object B.y = randomy

    While

    Object B.x = randomx

    Object B.y = randomy

    Object B.boo = true

    -->pick random value for randomx and randomy between maximum and minimum

    -->create Object A

    -->Object A.x = randomx

    -->Object A.y = randomy

    -----------------------------------

    For each object A

    Object B variable = object A variable

    -->set location

    -->Object B.boo = true

    basically what I am trying to do is make a loop that keeps on choosing random values of randomx and randomy until it finds an instance of Object B with the same corresponding values of its variables x and y but its boo is set to false (or not occupied). Then create Object A and set its local variables corresponding to random x and y. So that all instances of Object A occupies an unique instance of Object B.

    But it just does not work :p what ends up happening is that all instance of Object A have the same values of x and y and hence occupies the same instance of Object B

    pre thanks

  • You don't have to use while loop to random a value. At event 8 the system keep randomize the value, meanwhile event 9 does the same thing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Found a fix myself. Apparently some events just don't run when its a subevent of 'On start of Layout' so found a workaround. Thanks anyways though.

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