Sprite, set Z order right.

0 favourites
  • 3 posts
From the Asset Store
10 Beautiful Pokemon-like Building Pixel Art Sprite Sets
  • Do you feel my pain?

    What would be a good approach? Objects in this game move, so how would I keep them in the right order?

    Right now I am thinking of some hackish, loop that checks all objecs Y position.

    <img src="http://i1294.photobucket.com/albums/b603/oliverschoening/overlap_zps82fd21a7.png" border="0" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm using this system :

    Just add every objects in a family (eg "All")

    System -> For each All order by All.Y ascending -> All move to top of the layer.

  • I'm always a little iffy about using For Each too much. If you have a lot of stuff onscreen, I can imagine it causing slowdown at some point.

    The way I do it relies on collisions instead, also using a family for all objects.

    +"Sprite" overlaps "All"

    +Sub: Sprite.Y > All.Y

    -Sprite - move in front of All

    +Sub: Sprite.Y < All.Y

    -Sprite - move behind All

    That way you only check and change the Z order when it's actually necessary (when things collide).

    Though you do have to have these events for every object that might change it's Z order.

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