added missing height which led to an error otherwise

This commit is contained in:
Flavio Diez
2020-05-20 17:41:47 +02:00
parent 9954a20f2f
commit cfaf5dfe52

View File

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