clik-engine API
    Preparing search index...

    Class DestructibleTiles

    Tracks health for destructible tiles and manages visual stage transitions. Works with TilemapManager for tile replacement on damage/destruction.

    Usage:

    const destructible = new DestructibleTiles({ maxHealth: 100, destroyedTileIndex: 0 });
    destructible.setStages([
    { threshold: 0.5, tileIndex: 42 }, // cracked
    { threshold: 0.25, tileIndex: 43 }, // heavily damaged
    ]);
    destructible.registerTile(5, 3); // tile at grid (5,3) is destructible
    const result = destructible.damage(5, 3, 40);
    // result.newTileIndex = stage tile or destroyed tile
    Index

    Constructors

    Accessors

    Methods

    • Damage a tile. Returns the new tile index to display, or null if no change. Returns -1 when destroyed (use destroyedTileIndex).

      Parameters

      • tileX: number
      • tileY: number
      • amount: number

      Returns { destroyed: boolean; newTileIndex: number | null }