How do I make objects move behind player & stay relative

0 favourites
  • 10 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • I'm making a top down rpg kind of game and I'm having a problem with objects moving in front of others when they are moved behind the player.

    I have a family of objects that move behind the player when the player's Y is greater than the object's Y

    the problem is the objects in the family don't change on the Z order relative to each other so they move in front of objects they shouldn't.

    In the picture both the arm chair and the little table are in the "behindinfront" family.

    I hope this makes sense, it's a bit difficult to explain. I'd be very grateful for any suggestions as I'm at my wit's end.

    Thank you kindly,

    Keep well,

    Jack

  • it's a bit hard to understand. I think you need to make a small capx showing what you are trying to do.

    One thing to consider is making a system of layers for the player/background objects to be on.. then switch the player to different layers instead of doing Z order stuff which seems to be a bear..

    You said "top down rpg" that image does not look top down, but instead looks isometric.

  • Hi, thanks for the reply.

    I made a little capx. to try and explain better. If you move the player to the bottom the error occurs.

    I'm not sure if there is any good, simplish way to do this.

    https://www.dropbox.com/s/g696qkmusijx2 ... order.capx

    I hope this explains the problem a bit better.

    Thank you for the help,

    Keep well.

  • Hi jackspinoza

    I had this example, made for something totally different, that I think achieves what you want...

    http://examples.gamesintheattic.com/directions/

    Let me know if that's what you're looking for, so I send you the capx.

  • Hi Bruno,

    Thanks for the response! I think your example could perhaps work but the problem is when there are two background objects overlapping so it is hard to tell.

    I'd still be grateful to see if it does work, I've not got a clue about a fix :/

    Thanks again,

    take care.

  • I took a look at your capx and I noticed you are changing the Z of the scenario. I change the Z of the character, putting it in front of behind the nearest scenario item. This way I don't mess with the original Z relation among scenario items.

    By the way, do you know you can change the collision box for the player and objects? This way you don't need the green and red boxes you're using to check for collision. Just enter Edit Mode and click on the last tool button (Set collision tool).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Would this work?

    change the origin point of the objects to the bottom and then z-order sorting them based on their Y position?

  • Hey there,

    thanks so much for the responses. I tried changing the Z of the character instead, but it didn't work (see below capx).

    https://www.dropbox.com/s/zdbj02nm3jinw ... h%20Z.capx

    That sounds like a great way to do it Not quite sure how to implement that though. Any tips?

    Sorry for being such a pain.

    Keep well.

  • put everything you want z-ordered in a family.. (that means main character as well)

    system for each family order by family.y ascending - Move to top of layer

    So in your system conditions you should use the for each (ordered)

  • Fantastic! I am so very grateful. My problem is solved! Below is the capx. of how to z-order stuff in an isometric (sort of) game. Thanks LittleStain, Bruno and Jobel, you are very kind.

    https://www.dropbox.com/s/g696qkmusijx2 ... order.capx

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