relative z-order?

0 favourites
  • 4 posts
  • I'm working on a project with a birds eye view kind of like (Fallout 2 image) and need some help with z-order.

    For example: When I place a tree in the layout I want the players index to be higher when he's in front of the tree. The head of the player sprite should cover the tree. But if he's moving behind it the top of the tree sprite should cover the player when walking behind it, meaning that the the z-order of the tree should have changed. Collision boxes are already set to a small square at the base of both the tree and the player sprite, but I cant get the player to be both behind and in front of the tree.

    So what I'm looking for is a way to set the z-order of the tree relative to the player position, or according to the grid or something like that. Is that possible and how could it be done? I'm planning to have a lot of these kind of objects, where the player can walk behind them, and the player can also cover them.

    Any help appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • x goes from left to right.

    y goes from up to down.

    Knowing that you can guess that if the players y is greater than the trees, then the player is in front of it.

  • Well that much I can figure out myself, but how do I go about doing it? Using some function or what? And what would be the best way to do it since a LOT of objects needs the same kind of instructions.

  • There are dozens of ready to go examples here on forum explaining how you can do this. Use search and you will get what you want.

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