How do I randomly spawn infinite object every 10 pixels

  • What I need to do is spawn a object every 80y in either one of the four x column. If you have played the game piano tiles what I am trying to do is spawn a tile every 80y up the track in either one of the 4 columns. What I need to know is the expression or event to do this so many objects spawn on the start of the layout.


    Ps. I am not trying to remake piano tiles :/

  • Try using nested For loops. So for example:

    For "x" from 0 to 100:

    ---For "y" from 0 to 100:

    ------Create object YourSprite at (LoopIndex("x") * YourSprite.Width, LoopIndex("y") * YourSprite.Height)

    This example will create a 100 x 100 grid of sprites of an arbitrary size. You can, of course, change the loop bounds if you want more or less tiles. The expression LoopIndex(LoopName) returns where you are currently in a loop.

    Let me know if that helps at all. I'll clarify points if you have any questions.

  • all right thankyou I will try this tomorrow

  • I misunderstood what you wanted originally, I believe. Here's an example demonstrating what I think you want:


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thankyou very much

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