formatting files

This commit is contained in:
renato.soares
2019-08-09 15:26:48 -03:00
committed by Erick (CptBlackPixel)
parent ccc4677663
commit 110aa376d8
2 changed files with 10 additions and 6 deletions

View File

@ -21,12 +21,14 @@ class TiledGame extends BaseGame {
}
void __addCoinsInMap(TiledComponent tiledMap) async {
final ObjectGroup obj = await tiledMap.getObjectGroupFromLayer("AnimatedCoins");
final ObjectGroup obj =
await tiledMap.getObjectGroupFromLayer("AnimatedCoins");
if (obj == null) {
return;
}
for (TmxObject obj in obj.tmxObjects) {
final comp = AnimationComponent(20.0, 20.0, Animation.sequenced('coins.png', 8, textureWidth: 20));
final comp = AnimationComponent(
20.0, 20.0, Animation.sequenced('coins.png', 8, textureWidth: 20));
comp.x = obj.x.toDouble();
comp.y = obj.y.toDouble();
add(comp);

View File

@ -69,9 +69,10 @@ class TiledComponent extends Component {
final image = images[tile.image.source];
final rect = tile.computeDrawRect();
final src =
Rect.fromLTWH(rect.left.toDouble(), rect.top.toDouble(), rect.width.toDouble(), rect.height.toDouble());
final dst = Rect.fromLTWH(tile.x.toDouble(), tile.y.toDouble(), rect.width.toDouble(), rect.height.toDouble());
final src = Rect.fromLTWH(rect.left.toDouble(), rect.top.toDouble(),
rect.width.toDouble(), rect.height.toDouble());
final dst = Rect.fromLTWH(tile.x.toDouble(), tile.y.toDouble(),
rect.width.toDouble(), rect.height.toDouble());
c.drawImageRect(image, src, dst, paint);
});
@ -82,7 +83,8 @@ class TiledComponent extends Component {
Future<ObjectGroup> getObjectGroupFromLayer(String name) {
return future.then((onValue) {
return map.objectGroups.firstWhere((objectGroup) => objectGroup.name == name);
return map.objectGroups
.firstWhere((objectGroup) => objectGroup.name == name);
});
}
}