flame_tiled and/or 在网络上 运行 时,平铺包出错

flame_tiled and/or tiled package gives error when running on web

使用flame_tiled 插件加载平铺地图。 像这样通过 TiledComponent 加载地图:

tiledComponent = TiledComponent("new4.tmx", Size(32.0,32.0));
add(tiledComponent);

这在 mobile.However 上运行良好,当使用 flutter for web 时出现以下错误:

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following UnimplementedError was thrown during paint():
UnimplementedError

    The following RenderObject was being processed when the exception was fired: GameRenderBox#0eebf:
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=929.0, h=932.0)
  size: Size(929.0, 932.0)
This RenderObject has no descendants.
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: UnimplementedError

如果 'tiledcomponent' 没有被添加并且只渲染了一些 Sprite 也适用于 flutter web 但不是 TiledComponent。 任何解决方案?或者解决方法?

Flutter Channel beta, 1.23.0-18.1.pre flame 0.28.0 flame_tiled 0.1.0. tiled 0.6.0

不幸的是,该包不支持网络,它使用 Flames SpriteBatch API,它使用 Flutters canvas.drawAtlas 方法,但该方法尚未在网络上实现。

根据您要构建的内容,您可以尝试 Bonfire, it has its own engine to render a tiled map, and it supports web