Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

Creates a DuckEngine Tileset

description

The Tileset Class. Stores information about a tileset image and splits it into tiles

since

2.0.0

Hierarchy

  • Tileset

Index

Constructors

constructor

  • new Tileset(textureKey: string, tileW: number, tileH: number, rows: number, cols: number, game: Game, scene: Scene): Tileset
  • description

    Creates a Tileset instance

    since

    2.0.0

    Parameters

    • textureKey: string

      Key to the tileset image texture

    • tileW: number

      Width of each Tile

    • tileH: number

      Height of each Tile

    • rows: number

      Number of rows in the tileset image texture

    • cols: number

      Number of columns in the tileset image texture

    • game: Game

      Game instance

    • scene: Scene

      Scene instance

    Returns Tileset

Properties

cols

cols: number
memberof

Tileset

description

Number of columns in the tileset image

since

2.0.0

game

game: Game
memberof

Tileset

description

Game instance

since

2.0.0

rows

rows: number
memberof

Tileset

description

Number of rows in the tileset image

since

2.0.0

scene

scene: Scene
memberof

Tileset

description

Scene instance

since

2.0.0

texture

texture: Texture<"image">
memberof

Tileset

description

The Tileset image texture

since

2.0.0

tileH

tileH: number
memberof

Tileset

description

Height of each Tile

since

2.0.0

tileW

tileW: number
memberof

Tileset

description

Width of each Tile

since

2.0.0

tiles

tiles: Tile[]
memberof

Tileset

description

Array of tiles that are generated from the Tileset

since

2.0.0

Methods

Protected createTile

  • createTile(x: number, y: number, w: number, h: number): Tile

Protected generateTiles

  • generateTiles(): void

getTile

  • getTile(num: number): undefined | Tile
  • memberof

    Tileset

    description

    Gets the Tile based on index

    since

    2.0.0

    Parameters

    • num: number

      Index

    Returns undefined | Tile

Generated using TypeDoc