[SOLVED] How can I distribute a row of objects evenly and symmetrically?

0 favourites
  • 4 posts
From the Asset Store
Match the rows with tofus to clear the rows before you pass the cook.
  • Hi there,

    I'm trying to distribute a row of sprites evenly like this image:

    I'm trying to keep the same distance between each item regardless of how many items there are, and it should be a symmetrical distribution in relation to point X, does that make sense?

    I've tried searching on the forum and Google but maybe it's because I can't get the right words to describe it that I didn't find how to do it (English is not my main language).

    Let me know if it's clear enough.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, I think you can do a loop and create object at X position + loopindex*some value to spawn them in line. Like this :

    - For (number of instance to be created)

    - Create object at (X - (number of objects/2)*space between objects) + LoopIndex*space between objects, Y(previous spawn position + something))

    And tweak the formula to fix your goal.

  • Thanks, Nabu! That worked nicely. I had to do (loopindex+0.5) so they spawned symmetrically, otherwise it was one bit to the left.

    Thanks again for the super quick reply.

  • You're welcomed !

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