Tile constructor

Tile({
  1. required String spritePath,
  2. required Vector2 position,
  3. required Vector2 size,
  4. String? type,
  5. Map<String, dynamic>? properties,
  6. double offsetX = 0,
  7. double offsetY = 0,
})

Implementation

Tile({
  required String spritePath,
  required Vector2 position,
  required Vector2 size,
  this.type,
  this.properties,
  double offsetX = 0,
  double offsetY = 0,
}) {
  generateRectWithBleedingPixel(
    position,
    size,
    offsetX: offsetX,
    offsetY: offsetY,
  );
  if (spritePath.isNotEmpty) {
    loader?.add(
      AssetToLoad(Sprite.load(spritePath), (value) => this._sprite = value),
    );
  }

  _positionText = position;
}