create static method

TerrainSpriteSheet create({
  1. required String path,
  2. required Vector2 tileSize,
  3. Vector2? position,
})

Implementation

static TerrainSpriteSheet create({
  required String path,
  required Vector2 tileSize,
  Vector2? position,
}) {
  return TerrainSpriteSheet(
    left: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(0, 1) + (position ?? Vector2.zero()),
    ),
    topLeft: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(0, 0) + (position ?? Vector2.zero()),
    ),
    bottomLeft: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(0, 2) + (position ?? Vector2.zero()),
    ),
    right: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(2, 1) + (position ?? Vector2.zero()),
    ),
    topRight: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(2, 0) + (position ?? Vector2.zero()),
    ),
    bottomRight: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(2, 2) + (position ?? Vector2.zero()),
    ),
    top: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(1, 0) + (position ?? Vector2.zero()),
    ),
    bottom: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(1, 2) + (position ?? Vector2.zero()),
    ),
    invertedTopLeft: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(3, 0) + (position ?? Vector2.zero()),
    ),
    invertedTopRight: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(4, 0) + (position ?? Vector2.zero()),
    ),
    invertedBottomRight: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(4, 1) + (position ?? Vector2.zero()),
    ),
    invertedBottomLeft: TileSprite(
      path: path,
      size: tileSize,
      position: Vector2(3, 1) + (position ?? Vector2.zero()),
    ),
  );
}