mirror of
https://github.com/genxium/DelayNoMore
synced 2025-10-09 08:36:52 +00:00
Fixed non-integer barrier boundaries.
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="1" name="PlayerStartingPos">
|
||||
<object id="135" x="1290" y="1401.33">
|
||||
<object id="135" x="999" y="1608">
|
||||
<point/>
|
||||
</object>
|
||||
<object id="137" x="1648.33" y="1430.67">
|
||||
<object id="137" x="1164" y="1548">
|
||||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
@@ -25,7 +25,7 @@
|
||||
<property name="boundary_type" value="barrier"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="55" x="735" y="1552" width="113.5" height="15.5">
|
||||
<object id="55" x="736" y="1552" width="112" height="16">
|
||||
<properties>
|
||||
<property name="boundary_type" value="barrier"/>
|
||||
</properties>
|
||||
@@ -80,12 +80,12 @@
|
||||
<property name="boundary_type" value="barrier"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="73" x="783.75" y="1567.5" width="96.25" height="15.5">
|
||||
<object id="73" x="784" y="1568" width="96" height="16">
|
||||
<properties>
|
||||
<property name="boundary_type" value="barrier"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="74" x="815.75" y="1583.75" width="96.25" height="15.5">
|
||||
<object id="74" x="816" y="1584" width="96" height="16">
|
||||
<properties>
|
||||
<property name="boundary_type" value="barrier"/>
|
||||
</properties>
|
||||
|
@@ -440,7 +440,7 @@
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
216.05530045313827,
|
||||
216.50635094610968,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@@ -460,7 +460,7 @@
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
216.05530045313827,
|
||||
216.50635094610968,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@@ -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