clik-engine API
    Preparing search index...

    Class PhysicsBody

    Typed, fluent wrapper around a Phaser Arcade physics body. Eliminates the as unknown as cast pattern and adds config validation.

    const body = new PhysicsBody(scene, sprite, { drag: 300, collideWorldBounds: true });
    body.setVelocity(200, 0).setBounce(0.5);
    // Attach to an object that already has physics enabled
    const body = PhysicsBody.from(existingSprite);
    if (body) body.setVelocityX(100);
    Index

    Constructors

    Accessors

    Methods

    • Parameters

      • width: number
      • height: number
      • offsetX: number = 0
      • offsetY: number = 0

      Returns this