mirror of
https://github.com/genxium/DelayNoMore
synced 2025-10-09 00:26:39 +00:00
Fixed non-integer barrier boundaries.
This commit is contained in:
@@ -116,31 +116,28 @@ TileCollisionManager.prototype.extractBoundaryObjects = function(withTiledMapNod
|
||||
const allObjectGroups = tiledMapIns.getObjectGroups();
|
||||
for (let i = 0; i < allObjectGroups.length; ++i) {
|
||||
var objectGroup = allObjectGroups[i];
|
||||
if ("PlayerStartingPos" == objectGroup.getGroupName()) {
|
||||
var allObjects = objectGroup.getObjects();
|
||||
for (let j = 0; j < allObjects.length; ++j) {
|
||||
const cccMaskedX = allObjects[j].x,
|
||||
cccMaskedY = allObjects[j].y;
|
||||
const origX = cccMaskedX,
|
||||
origY = withTiledMapNode.getContentSize().height - cccMaskedY; // FIXME: I don't know why CocosCreator did this, it's stupid and MIGHT NOT WORK IN ISOMETRIC orientation!
|
||||
let wpos = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, cc.v2(origX, origY));
|
||||
toRet.playerStartingPositions.push(wpos);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ("barrier_and_shelter" != objectGroup.getProperty("type")) continue;
|
||||
var allObjects = objectGroup.getObjects();
|
||||
for (let j = 0; j < allObjects.length; ++j) {
|
||||
let object = allObjects[j];
|
||||
let gid = object.gid;
|
||||
if (0 < gid) {
|
||||
continue;
|
||||
}
|
||||
const boundaryType = object.boundary_type;
|
||||
let toPushBarrier = [];
|
||||
toPushBarrier.boundaryType = boundaryType;
|
||||
switch (boundaryType) {
|
||||
case "barrier":
|
||||
switch (objectGroup.getGroupName()) {
|
||||
case "PlayerStartingPos":
|
||||
for (let j = 0; j < allObjects.length; ++j) {
|
||||
const cccMaskedX = allObjects[j].x,
|
||||
cccMaskedY = allObjects[j].y;
|
||||
const origX = cccMaskedX,
|
||||
origY = withTiledMapNode.getContentSize().height - cccMaskedY; // FIXME: I don't know why CocosCreator did this, it's stupid and MIGHT NOT WORK IN ISOMETRIC orientation!
|
||||
let wpos = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, cc.v2(origX, origY));
|
||||
toRet.playerStartingPositions.push(wpos);
|
||||
}
|
||||
break;
|
||||
case "Barrier":
|
||||
for (let j = 0; j < allObjects.length; ++j) {
|
||||
let object = allObjects[j];
|
||||
let gid = object.gid;
|
||||
if (0 < gid) {
|
||||
continue;
|
||||
}
|
||||
const boundaryType = object.boundary_type;
|
||||
let toPushBarrier = [];
|
||||
toPushBarrier.boundaryType = boundaryType;
|
||||
let polylinePoints = object.polylinePoints;
|
||||
if (null == polylinePoints) {
|
||||
polylinePoints = [{
|
||||
@@ -163,10 +160,8 @@ TileCollisionManager.prototype.extractBoundaryObjects = function(withTiledMapNod
|
||||
}
|
||||
toPushBarrier.anchor = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, object.offset); // DON'T use "(object.x, object.y)" which are wrong/meaningless!
|
||||
toRet.barriers.push(toPushBarrier);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user