Making character collide only with objects on the same layer

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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!

  • Try Construct 3

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

    Try 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)