(resolved) How do I sort sprites by their Y-position?

0 favourites
  • 3 posts
From the Asset Store
amazing template of the game of ordering colors with strings made with construct3 (requires c3 license) optimized with j
  • Hi

    I'm trying out a prototype (see attached screenshot) where I have a whole bunch of sprites in a fake "depth". I'm trying to find a way to sort all of these objects so that they render from top to bottom, so that all things high up on the screen will render first (on the bottom) and gradually all other items are drawn on top of previous sprites.

    How do I do this?

    In an earlier stage I only had one moving character, which was a lot easier since I could compare that character's Y-position to all other elements (if their Y > Player Y then I would move them to a layer below, conversely I'd move things in front to a layer on top of the player)

    Now that I'm introducing multiple moving elements I don't know how to formulate a function that does this. I think it should all hapen on one single layer and that I probably need to do this sorting every tick, but IDK.. I'm guessing I need a loop of some sort, but how do I write it?

    Hope this makes sense, any help would be awesome

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Watch "about isometric" (construct 2 General) from me.

  • Awesome! Thanks.

    This did the trick for me:

    (link to the post)

    https://www.scirra.com/forum/about-isometric_t120594

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