interface CreateEntityOptions {
    buttons?: EntityButton[];
    collidableEntityTypes?: string[];
    collidesWithMap?: boolean;
    ellipses?: EntityEllipse[];
    fieldValues?: Map<string, unknown>;
    height: number;
    layerID: string;
    levelID: string;
    onCollision?: ((collisionData) => void);
    onOverlap?: ((overlapData) => void);
    position: EntityPosition;
    quadrilaterals?: EntityQuadrilateral[];
    sprites?: EntitySprite[];
    type?: string;
    width: number;
    zIndex?: number;
}

Properties

buttons?: EntityButton[]
collidableEntityTypes?: string[]
collidesWithMap?: boolean
ellipses?: EntityEllipse[]
fieldValues?: Map<string, unknown>
height: number

The actual height of the hitbox of the entity

layerID: string

The layerID the entity should be on, has to be created in LDTK

levelID: string
onCollision?: ((collisionData) => void)

Callback that triggers whenever a collision stops entites from moving through each other. Will not trigger on tiles that have ppCollision set to true. The same collision cannot trigger onCollision and onOverlap

Type declaration

    • (collisionData): void
    • Parameters

      Returns void

onOverlap?: ((overlapData) => void)

Callback that triggers whenever an entity passes through another. The same collision cannot trigger onCollision and onOverlap

Type declaration

    • (overlapData): void
    • Parameters

      Returns void

position: EntityPosition

The X and Y position that the entity will spawn at

quadrilaterals?: EntityQuadrilateral[]
sprites?: EntitySprite[]
type?: string
width: number

The actual width of the hitbox of the entity

zIndex?: number

This number determines how entities are layered on-top of eachother