Z Depth/Solidity

For questions about using Classic.

Post » Sun May 03, 2009 11:25 am

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?
B
2
S
1
G
4
Posts: 33
Reputation: 1,266

Post » Sun May 03, 2009 11:47 am

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
[code:3kazfhi3]
-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?
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Sun May 03, 2009 12:10 pm

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 :).
B
2
S
1
G
4
Posts: 33
Reputation: 1,266

Post » Sun May 03, 2009 6:12 pm

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
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Sun May 03, 2009 11:58 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon May 04, 2009 12:44 pm

I don't think we're talking to each other :D
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! :)
B
2
S
1
G
4
Posts: 33
Reputation: 1,266


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests