Tile constructor

Tile(
  1. String spritePath,
  2. Vector2 position, {
  3. double width = 32,
  4. double height = 32,
  5. String? type,
  6. Map<String, dynamic>? properties,
})

Implementation

Tile(
  String spritePath,
  Vector2 position, {
  this.width = 32,
  this.height = 32,
  this.type,
  this.properties,
}) {
  this.position = generateRectWithBleedingPixel(position, width, height);
  if (spritePath.isNotEmpty) {
    _loader = AssetsLoader();
    _loader?.add(
      AssetToLoad(Sprite.load(spritePath), (value) => this._sprite = value),
    );
  }

  _positionText = position;
}