Isometric games and variable depth

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hey there!

    Just decided to make the switch from GameMaker to Construct 2 (mainly because of delta time) and have been slowly getting a hang of the event-based system, rather than object based.

    I'm making an isometric rpg-like game. One thing I'm completely stuck on is how to make different sprites pass in front/behind each other depending on their y value.

    In gamemaker it's just, every tick : depth = -y

    I found a tutorial that looks like it sort of works? scirra.com/tutorials/1165/z-ordering-on-a-isometric-grid

    but I don't really understand it... You have to check if two things overlap, but then you have to do that for every single pair of sprites? I tried to put it a family but does it check if a specific instance passes in front or behind another?

    on collision > compare values - sprite1.y > sprite2.y : sprite1.y pass behind

    Is there no way access built in variables for objects? You can set the x and y of something why not the z? And like reset the z every tick. Or is that going to slow the game down?

    Actually someone here mentions it scirra.com/forum/isometric-multiple-floors_t121850

    "Z-height = y offset" but I have no idea how to apply that to the event system

    Anyway, thanks for the help in advance, I really like the engine overall so far!!

    olga

    (ps. how do I get links to work?)

  • A lot depends on how you have set things up..

    Usually an:

    player "on collision" with thing

    --player.y < thing.y

    thing move to object - in front : player

    else

    thing move to object - behind : player

    does the trick if before executing this triggered event the z-ordering is correct..

  • Thanks for the quick reply!

    Hmm yea I guess I see how that would work, but does this mean I have to set up this check for everything on the screen that is moving? I have a couple characters and enemies, just wondering if there is any shortcut.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another solution is to use for each and place all the things that you need to sort in a Family.

    For each Family1 order by family.Y ascending > Move to top of layer.

    This is a shortcut but can get very heavy since it will sort all objects every tick.

  • Ah sweet, yea that makes sense. Thanks!

    I'll use it for now and if it starts to get slow, figure out something else I guess.

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