How do I layer an object to appear on top of/or below of sprite in different situations?

0 favourites
  • 9 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I'm making semi-birds-eye platform and I want my sprite to appear in front of the tree when stepped 'down/south' onto the road, but when he's back up on the pavement and positioned in line with the tree, I want him to appear behind the tree. Like in a real life situation. Is there a simple method? Is there a clever method?

    I have included an image to help demonstrate.

  • Put every object that needs to be Z ordered into a Family and use the logic : for each Family ordered by Y ascending : move to top of layer

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks guys I've given it a go but I'm wondering if I'm doing something wrong as it's not working for me. I've used the tutorial code and copied it into my event sheet. Does this look right? My player seems to walk behind the trees but never in front. This is likely due to him being layered on top of the trees family in the first place. It looks something like this:

  • Your event 2 is inside the loop, which is wrong. It needs to be executed after all 40 trees are created. Check my demo again to see how these events should be organized.

    And of course the player and the trees should be on the same layer.

  • Right I still haven’t had much luck. My player still only moves in front of the tree and when he doesn’t he collides with it as it’s a solid. I’ve taken a different approach and found another tutorial (although my game isn't full isometric) involving placing image points on single objects.

    Does the player need to be on the same layer as the tree (s) initially? I have 4: background, behind, players and infront.

    I have a single ‘YCompare’ image point at the bottom of the tree, does it need to be on the player sprite AND on tree?

    Does the tree object need to have the collision polygon filling the whole tree or just the bottom bit, like the player?

    Do I need to add to my event sheet, and is there anything I don’t need to include?

    Is there anything I need to check?

  • My player still only moves in front of the tree and when he doesn’t he collides with it as it’s a solid.

    Wait, your trees are solid?? Then how the player is supposed to get behind them? Does my example work if you remove Solid behavior?

    If you don't want the player to collide with trees, you need to define collision polygons on the tree trunk only, and also enable/disable the Solid behavior with events, depending on player position.

  • Ok thanks. I'll try this out soon as I'll work on other parts for now

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