TileComponent constructor

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

Implementation

TileComponent({
  required String spritePath,
  required Vector2 position,
  required Vector2 size,
  this.tileClass,
  this.color,
  Map<String, dynamic>? properties,
  double offsetX = 0,
  double offsetY = 0,
}) {
  this.properties = properties;
  applyBleedingPixel(
    position: position,
    size: size,
    offsetX: offsetX,
    offsetY: offsetY,
    calculatePosition: true,
  );
  if (spritePath.isNotEmpty) {
    loader?.add(
      AssetToLoad(Sprite.load(spritePath), (value) => _sprite = value),
    );
  }
}