TileComponent.fromSprite constructor

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

Implementation

TileComponent.fromSprite({
  required Sprite? sprite,
  required Vector2 position,
  required Vector2 size,
  this.tileClass,
  Map<String, dynamic>? properties,
  double offsetX = 0,
  double offsetY = 0,
  this.color,
}) {
  this.properties = properties;
  id = '${position.x}/${position.y}';
  _sprite = sprite;
  applyBleedingPixel(
    position: position,
    size: size,
    offsetX: offsetX,
    offsetY: offsetY,
    calculatePosition: true,
  );
}