How do I control z-order in isometric map

0 favourites
  • 15 posts
From the Asset Store
Create your own adventure map with this easy to use asset pack.
  • I intend to create a game using isometric graphics. When I was planning the game, I noticed that I'll have trouble to control the order of objects when they are spawned because the player can added them anywhere on the map. Someone would have an idea of how to make the objects staying in the correct order regardless of the sequence in which they are placed on the map?

    Thanks

  • Put all sprites on your map in a family. Then make a function you call everytime the player changed something on the map:

    foreach spritefamily

    ordered by spritefamily.Y ascending

    Spritefamily move to top of layer

  • Hi Thanks for your help. I'll try it and then return to tell.

  • : Sometime it works, sometimes not. An example: I'm including objects and the order it's right until insert the third one. In the next inclusion, objects in the wrong order appears corrected. It is a very strange behavior. I'm attach the capx so you can view it and show me what I can doing wrong. Thank you.

    https://www.dropbox.com/s/5xshuvuyp6q6ngw/test.capx

  • Thanks, that was exactly what I was looking for too.

  • Hi You're welcome! Unfortunately still not working 100%. I hope the can help us to fix this.

  • RenatoB

    It doesn't work 100% because the newly created object can't be picked in the function.

    The solution is to either add a wait 0 before calling zorder or just run it every tick.

  • Create a "Wait 0 " action right before you call zorder().

  • I was trying this out but it has some flaws, since it only works for objects within the family, ie, particles, bullets etc that are not "sprites" won't get ordered correctly. There must be some workaround for this. Is there any way to set the zIndex to a specific number depending on the objects y position? I also think sorting all objects in a sprite intense layout every tick will be quite heavyweight calculations wise.

  • RenatoB

    It doesn't work 100% because the newly created object can't be picked in the function.

    The solution is to either add a wait 0 before calling zorder or just run it every tick.

    Thanks for the explanation, I fixed it.

    Create a "Wait 0 " action right before you call zorder().

    Thank you for this nice solution,

  • I was looking around the forum and tried to find a solution for moving objects (both the player and NPC's etc) in an isometric setup and I came up with this solution, mixing layers and z-ordering and it came out quite nice. Hope this can help others out too trying to make isometric games.Yesterday I thought this would be impossible, but with a bit of research and trial and error i solved it.....

    * Edit - I didn't have enough rep to post the link to the project file, so sending a picture instead, will send link as soon as i have enough rep.

  • This is very helpful, thank you!

  • Finally i have enough reputation to post the link to the project file. Hopefully this will help out people doing games with isometric perspective.

    https://dl.dropboxusercontent.com/u/20560446/z_order_isometric.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nice job, Downloaded and archived for future use.

  • Could you reupload the capx pls

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