How do I sort layer ordering for top down walls

0 favourites
  • 5 posts
From the Asset Store
amazing template of the game of ordering colors with strings made with construct3 (requires c3 license) optimized with j
  • Trying to make the character object go to either a front or a back layer in relation to the walls/roof in the top down perspective of my game; to give the illusion that the characters are actually "in front of" or "behind" these walls - something pretty necessary for such kind of game.

    However, I don't know if I understood the tiles expressions from the Tilemap object right, but IMO they seem to be rather limited in terms of precision and control of WHICH tiles you're picking in relation to some object's position.

    Here's when the player is behind the wall, working properly:

    However, things change when he's in front of it. His head will get underneath the front wall until he crosses through like half of it (2 32x32 tiles height wall).

    Here's when his head will appear underneath it:

    (AnimationSprites is the family of all character sprites)

    I'd like to know a way to sort it out in a way that this "effect" doesn't happens; as it's (in my knowledge) because the SnapY function will choose only the nearest tile Y avaliable, and not take X into account.

    Already tried dozens of different combinations of the PositionToTileX,Y, TileToPosition expression and so on; so far no good.

    I mean, if there's a way, that is. If there's not then I'd like to request a more precise way to pick tiles based on a X,Y point.

    And here's when it actually gets in front of it (halfway through the wall's height)

    The event block used to sort it out:

  • It works using a pick condition

    demo project in r212 https://1drv.ms/u/s!AkmrWgxeuxlKhIZ_GEdQ-lOfJdG1xQ?e=FivpNt

    Use two different tilemap objects for your upper and lower walls.

    If you used 3 layers: fg, player & bg and two tilemaps, 1 for lower fg walls and one for upper bg walls then the player in the layer in the middle you wouldn't even need events.

  • Oh yeah, thanks for the suggestion. But already knew about this way.

    The pick condition, sadly only works for the tilemaps themselves, and not the tiles.

    You see, the problem is: If there's a taller object (like the boss, for example), it'll probably surpass the lower walls height and get blocked by upperwalls in the head. That's why I went for the supposedly cleaner solution - to change the character's layer itself, so it'll always be in the foreground whenever it's nearest to a lower wall object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Actually, nvm. Found a solution already.

    But thanks for the reply anyways, tho.

  • give us the solution for when someone googles this thread!

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