Making character collide only with objects on the same layer

Get help using Construct 2

Post » Sun Oct 11, 2015 10:49 pm

How could I make my character with platform behavior only collide with objects/enemies on the same layer? I have quite a lot of different objects that need to be on multiple layers and I'm looking for an efficient/elegant way to solve this without making tons of events for all the different objects. I think it might be easier to disable collisions on the character itself as needed (rather than try to manipulate everything else), but if anyone has any other ideas or has tackled similar problem before I'd love to hear your thoughts on this. Thanks a lot in advance, any help is appreciated!
B
32
S
9
G
4
Posts: 132
Reputation: 4,348

Post » Mon Oct 12, 2015 12:02 am

For collisions with enemies you can add the "Is On Layer" condition in your collision events to filter out objects on other layers.
Unless you talk about solids, which is a different beast and might be better treated by grouping them into a family.
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Mon Oct 12, 2015 12:02 am

on your collision event add additional condition:
system compare player.layernumber=object.layernumber

Now the player should only interact with the object if the layer number is the same
B
60
S
36
G
23
Posts: 341
Reputation: 17,157

Post » Tue Oct 13, 2015 5:10 pm

Thanks for the replies, unfortunately my game uses solids heavily so I'm still trying to figure this out. I also use platform behavior for some enemies and if I disabled their collisions or disabled the solids they're moving on they'd just fall from layout. Can families be used to solve this somehow? Is there any example how this could be achieved/workaround?
B
32
S
9
G
4
Posts: 132
Reputation: 4,348


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 6 guests