Ignoring collision from one layer to another

For questions about using Classic.

Post » Tue Jun 08, 2010 4:30 pm

So... I have a simple question (or maybe it's complicated, who knows xD)
In the game i'm making there will be multiple layers, and i want the player to be able to go from one layer to the other on certain points...
The problem is, i wanna make it so that when the player is in the front layer it does not recognize the collision with objects in the back layer (and vice versa) how do i do this on construct?
B
2
G
2
Posts: 19
Reputation: 688

Post » Tue Jun 08, 2010 5:16 pm

Add a condition like "Object A layer does not equal Object 2 layer".
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Jun 08, 2010 9:06 pm

You don't get it.... I want ALL the objects on layer one to COMPLETELY ignore the objects on layer two!
You see... It's a plataforming game... (and it uses the plataform behaviour)
And i wanna be able to jump into the background/back to the foreground in certain areas (a pseudo-3D gimmick, kinda like VB wario land)
B
2
G
2
Posts: 19
Reputation: 688

Post » Wed Jun 09, 2010 2:14 am

[quote="terry":120b2ab4]You don't get it.... I want ALL the objects on layer one to COMPLETELY ignore the objects on layer two![/quote:120b2ab4]
First, if you want an answer to a question then you have to ASK the question. Second, the answer Ashley gave will work for you, just apply that to all of the collisions/objects you are interested in! You could do something like set a private variable in all of the objects that are on a certain layer and temporarily turn off collisions for those that have the PV set, but I think it is simpler to just check the layers per collision condition. You might consider using a for loop to loop through all objects on a layer and handle it that way.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Wed Jun 09, 2010 1:13 pm

Probably the easiest way would be to do this:

Add your objects in different layers to two families. For example, put Layer 1 objects into Family Yellow, and Layer 2 objects into Family Blue.

Now, in events:

When Player is on Layer 1
-> Remove attribute from Blue: "Solid"
-> Add attribute for Yellow: "Solid"

When Player is on Layer 2
-> Remove attribute from Yellow: "Solid"
-> Add attribute for Blue: "Solid"
B
16
S
8
G
4
Posts: 136
Reputation: 3,144


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests