问题描述
使用flame_tiled插件加载平铺的地图。 通过TiledComponent加载地图,如下所示:
tiledComponent = TiledComponent("new4.tmx",Size(32.0,32.0));
add(tiledComponent);
这在移动设备上效果很好。但是,在将Flutter用于网络时,出现以下错误:
══╡ 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
如果未添加“平铺组件”,并且仅渲染了一些Sprite,但在Sputter Web上也可以使用,但TiledComponent却没有。 有什么办法吗?还是解决方法?
扑通通道beta,1.23.0-18.1。预燃0.28.0 flame_tiled 0.1.0。 平铺0.6.0
解决方法
很遗憾,该软件包不支持Web,它使用Flames SpriteBatch
API,该API使用Flutters canvas.drawAtlas
方法,并且该方法尚未在Web上实现。
根据您要构建的内容,您可以尝试Bonfire,它具有自己的引擎来渲染平铺地图,并且它supports web