getTilesetByGid(gid) {
		let invalidRange = -1;

		// clear the gid of all flip/rotation flags
		gid &= TMX_CLEAR_BIT_MASK;

		// cycle through all tilesets
		for (let i = 0, len = this.tilesets.length; i < len; i++) {
			// return the corresponding tileset if matching
			if (this.tilesets[i].contains(gid)) {
				return this.tilesets[i];
			}
			// typically indicates a layer with no asset loaded (collision?)
			if (
				this.tilesets[i].firstgid === this.tilesets[i].lastgid &&
				gid >= this.tilesets[i].firstgid
			) {
				// store the id if the [firstgid .. lastgid] is invalid
				invalidRange = i;
			}
		}
		// return the tileset with the invalid range
		if (invalidRange !== -1) {
			return this.tilesets[invalidRange];
		} else {
			throw new Error("no matching tileset found for gid " + gid);
		}
	}
return the tileset corresponding to the specified id <br>
will throw an exception if no matching tileset is found
@param {number} gid
@returns {TMXTileset} corresponding tileset