ecspresso
    Preparing search index...

    Function createCollisionLayer

    • Create a collision layer component.

      Type Parameters

      • L extends string

      Parameters

      • layer: L

        The layer this entity belongs to

      • collidesWith: readonly L[]

        Layers this entity can collide with

      Returns Pick<CollisionComponentTypes<L>, "collisionLayer">

      Component object suitable for spreading into spawn()

      ecs.spawn({
      ...createTransform(100, 200),
      ...createAABBCollider(50, 30),
      ...createCollisionLayer('player', ['enemy', 'obstacle']),
      });