Fitting sprites into an area

0 favourites
  • 3 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • How can I fit a number of sprites into a given (not necessarily rectangular) area? Please see the attached pic. In my case each sprite in a given run will be the same size, but they can be different sizes on different runs. On each run I will know ahead of time how many sprites there will be. I don't want to use platform/solid or physics but open to 3rd party plugins. The appearance can be somewhat irregular as seen in the pic. Thanks.

    [attachment=0:2l653lv7][/attachment:2l653lv7]

  • One way would be to push the boxes away from each other and push then inside the triangle. To do it instantly you can put events 5 and 7 as sub-events of:

    Start of layout

    repeat 20 times

    or something like that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's amazing. I've tried the 'instant' method (which is what I need) and it works great. I've created 20 boxes on startup then have a one-off 'repeat 50 times' loop to get the boxes to 'settle' but it would be interesting to know an optimal number of iterations to use to provide good enough results (maybe checking when dist or edgeDist values settle, or something (guessing)). I haven't even checked out the 'box' method in the code yet. Here's my mods. Thanks again.

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