How do I make objects move behind player & stay relative

Get help using Construct 2

Post » Wed Jul 16, 2014 2:42 am

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
Image

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.
Image
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
B
12
S
2
Posts: 12
Reputation: 847

Post » Wed Jul 16, 2014 4:43 am

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.
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Wed Jul 16, 2014 3:52 pm

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.
B
12
S
2
Posts: 12
Reputation: 847

Post » Wed Jul 16, 2014 4:01 pm

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.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
19
S
5
G
2
Posts: 534
Reputation: 3,235

Post » Wed Jul 16, 2014 4:24 pm

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.
B
12
S
2
Posts: 12
Reputation: 847

Post » Wed Jul 16, 2014 4:28 pm

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). :)
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
19
S
5
G
2
Posts: 534
Reputation: 3,235

Post » Wed Jul 16, 2014 4:34 pm

Would this work?
change the origin point of the objects to the bottom and then z-order sorting them based on their Y position?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jul 16, 2014 5:05 pm

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 @LittleStain. Not quite sure how to implement that though. Any tips?

Sorry for being such a pain.
Keep well.
B
12
S
2
Posts: 12
Reputation: 847

Post » Wed Jul 16, 2014 5:28 pm

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)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jul 16, 2014 5:55 pm

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
B
12
S
2
Posts: 12
Reputation: 847


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 50 guests