mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 20:13:50 +08:00
formatting files
This commit is contained in:
committed by
Erick (CptBlackPixel)
parent
ccc4677663
commit
110aa376d8
@ -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);
|
||||
|
||||
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user