loadObject method

Future<void> loadObject(
  1. String path,
  2. LoadedType type, {
  3. bool show = true,
  4. List<Rect>? locations,
  5. ObjectType? objType,
  6. List<String>? names,
  7. List<double>? scales,
})

Implementation

Future<void> loadObject(
  String path,
  LoadedType type,
  {bool show = true,
  List<Rect>? locations,
  ObjectType? objType,
  List<String>? names,
  List<double>? scales
}) async{
  await _loadImage(path).then((value) async{
    int height = (allObjectImage == null?0:allObjectImage!.height);
    loadedObjects.add(
      LoadedObject(
        size: Size(value.width.toDouble(),value.height.toDouble()),
        objectType: objType??ObjectType.landscape,
        type: type,
        path: path,
        show: show,
        spriteLocations: locations,
        spriteNames: locations == null?names:(names ??List<String>.filled(locations.length, 'Object Names')),
        objectScale: scales,
        offsetHeight: height
      )
    );

    if(allObjectImage == null){
      allObjectImage = value;
    }
    else{
      await _combineImage(allObjectImage!,value).then((img){
        allObjectImage = img;
      });
    }
    update();
  });
}