MapTerrain constructor

MapTerrain({
  1. required double value,
  2. required List<TileModelSprite> sprites,
  3. List<double> spritesProportion = const [],
  4. String? type,
  5. Map<String, dynamic>? properties,
  6. List<CollisionArea>? collisions,
  7. bool collisionOnlyCloseCorners = false,
})

Implementation

MapTerrain({
  required this.value,
  required this.sprites,
  this.spritesProportion = const [],
  this.type,
  this.properties,
  this.collisions,
  this.collisionOnlyCloseCorners = false,
}) {
  int last = 0;
  for (var element in spritesProportion) {
    final value = (element * 100).toInt();
    _rangeProportion.add(_RandomRange(last, (last + value)));
    last += value;
  }
}