# Z Depth/Solidity

This forum is currently in read-only mode.
0 Favourites
• 6 posts
• Erm, okay, I have this problem:

I use a private variable on Player 1 for the z depth of this player. Now, when the z of the player is higher(e.g. by jumping) than an obstacle, the collision mode of the obstacle is changed to "none".

Now, when I have two players, this method doesnt work anymore because one player can be higher and one lower than the obstacle.

Help?

• if you can post a cap file it'd be easier to diagnose the problem

i'm guessing you're making your own collision thingamajig

but you should set up the collision statement to work something like this

-on collision with box
-pick by comparison - players('zdepth') = box('zdepth')[/code:3kazfhi3]

that way it's checking per player per collision if the zdepth is equal
you don't want to disable collisions for the box, you only want to ignore them if they aren't on the same zplane

nahmean?
• I understand that - you can pick the object with the higher z variable.

But how can I ignore the collisions for the obstacle? I'm using the 8-directional movement behavior, without a custom collision system. If that is be easier, pointers would be greatly appreciated .

• ## Try Construct 3

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

Construct 3 users don't see these ads
• it depends on how jumping works with your character

can they turn around with 8 direction halfway through the jump?

can they land on top of obstacles?

if the answer to both is no

there might be another way, but you could disable 8 direction behavior during the jumps, and just move your character the way they were already moving until they land

• This is possible with ordinary events, you've probably just got things in the wrong order. A .cap would help. However, I'd advise instead of fully disabling collisions to prevent a collision event running, just add an extra condition to the collision event! eg.:

+ On player collision with obstacle

+ Player Z is whatever

-> Do actions

This is much more robust - it still allows collision checking with other objects, and it probably works the way you want it too as well.

• I don't think we're talking to each other

The detection is no problem, the action is. I am using the 8-directional movement behavior, so for the moment I'll just use bounce. But other suggestions on how to stop(!) the player are also appreciated, because bounce can be tricked by moving very slowly .

EDIT: Ah, screw it, I made my own movement system. Thanks for the great program Ashley!