0 Favourites

Making character collide only with objects on the same layer

  • 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!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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

  • 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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,489
DMT2005's avatar
DMT2005
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,817
minhcuong's avatar
minhcuong
Unread hot topic Locked topic
83 19,085
Kyatric's avatar
Kyatric Construct Team Support