TileModel.fromMap constructor

TileModel.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory TileModel.fromMap(Map<String, dynamic> map) {
  return TileModel(
    x: map['x'],
    y: map['y'],
    offsetX: map['offsetX'] ?? 0,
    offsetY: map['offsetY'] ?? 0,
    width: map['width'],
    height: map['height'],
    type: map['type'] as String?,
    properties: map['properties'] as Map<String, dynamic>?,
    sprite:
        map['sprite'] == null ? null : TileModelSprite.fromMap(map['sprite']),
    animation: map['animation'] == null
        ? null
        : TileModelAnimation.fromMap(map['animation']),
    collisions: map['collisions'] == null
        ? null
        : (map['collisions'] as List).map((e) {
            return CollisionArea.fromMap(e);
          }).toList(),
  );
}