Manual: Collision Settings — CollisionLayer and CollisionMask

ACTION GAME MAKER uses the collision layer system directly from Godot. When used effectively, this allows for a wide variety of collision behaviors and interactions.


Where to Configure Collisions

Wall Collisions

Attack Collisions

  • AttackArea2D: CollisionObject2D > Collision

Hit Collisions

  • HitArea2D: CollisionObject2D > Collision

Understanding CollisionLayer and CollisionMask

  • Collision Layer: Indicates which layer(s) the object belongs to.
  • Collision Mask: Indicates which layer(s) the object wants to collide with.

Order of Collision and Group/AttackAttribute Checks

  1. Collision processing (Collision Layer / Collision Mask)
  2. Group / AttackAttribute processing

This means that group or attribute checks are only performed after collision has been detected. Therefore, if two objects or tiles do not collide, their group/attribute processing will not be executed.

Organizing Collision Layer Names

You can assign names to collision layers via:
Project Settings > General > Layer Names > 2D Physics

Once set, hovering your cursor over the layer number will show the assigned name.


Unidirectional Collisions

Because CollisionMask is one-directional, it allows for asymmetrical interaction:

Example:

  • Object A: Layer = 1, Mask = 1
  • Object B: Layer = 2, Mask = 1, 2

Object A will not detect Object B, but Object B will detect Object A.

This leads to a unique outcome:

  • Object A can push Object B, but
  • Object B cannot push Object A

Why?

This is due to a slightly advanced concept:

  • Object A doesn’t recognize Object B, but it still moves.
  • Object B, which does recognize Object A, tries to apply push-back physics.
  • However, since Object A does not recognize the collision, it doesn’t respond, and does not move even 1px.

Moving Platforms You Can Stand On

You can use this behavior to create platforms that carry characters without shifting from collision.

To do this:

  • Set the moving platform’s Collision Mask to nothing (empty).
  • This makes the platform immune to being pushed by anything, but still capable of carrying objects standing on it.