How do I set spawning points with while?

  • Hello everyone!,

    I've trying to randomly spawn some objects with the "while" command in a 4x4 arrangement, and everything goes great until I have to change the "Y" position.

    Ideally, it will look like this:

    [attachment=2:d8y3hykh][/attachment:d8y3hykh]

    But I'm ending up with this (been trying with only 5 objects atm):

    [attachment=1:d8y3hykh][/attachment:d8y3hykh]

    Sometimes I get only one object in the 1st row, and four on the second, etc.

    This is my event page:

    [attachment=0:d8y3hykh][/attachment:d8y3hykh]

    My logic is the following:

    When i>3 (meaning that 4 cards have been laid)

    Create object at x,(new Y position, because it is a new row!)

    I've been smashing my head against the keyboard for days because of this, any help is greatly appreciated!

  • What if you have all the positions "hard coded". So, if the number is 3 or lower, they ll spawn at x=[0,120,240] y=[0] and if its bigger they will spwan the first line as before and then you add another "Y".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What if you have all the positions "hard coded". So, if the number is 3 or lower, they ll spawn at x=[0,120,240] y=[0] and if its bigger they will spwan the first line as before and then you add another "Y".

    Isn't that what I have at "4" on the event page?

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