目前的版本,看似暂不支持TiledMap的tile的碰撞属性,建议做如下添加
-
TMXMapInfo中加入如下成员
protected _tileObjectGroups: Map<GID, TMXObjectGroupInfo> = new Map(); -
TMXMapInfo的initWithXML中加入如下代码
this._tileObjectGroups = new Map(); -
TMXMapInfo中的函数parseXMLString中,在如下代码
this._tileProperties.set(pid, getPropertyList(tile));
的后面加上let objectGroupNodes: Element[] = tile.getElementsByTagName(‘objectgroup’) as unknown as Element[];
if (objectGroupNodes.length > 0) {
assert(objectGroupNodes.length == 1);
const objectGroup = this._parseObjectGroup(objectGroupNodes[0]);
this._tileObjectGroups.set(pid, objectGroup);
} -
然后给TiledMap对象提供与_tileProperties类似的相关成员和接口便可