mirror of
https://github.com/photonstorm/phaser
synced 2024-12-23 11:33:28 +00:00
added deep copy, doesn't change anything , this.orientation in the tile still bugging
This commit is contained in:
parent
050325bff0
commit
a82b27ce6f
7 changed files with 74 additions and 57 deletions
36
dist/phaser-arcade-physics.js
vendored
36
dist/phaser-arcade-physics.js
vendored
|
@ -12463,9 +12463,13 @@ var Tile = new Class({
|
||||||
* @since 3.2.PR_svipal
|
* @since 3.2.PR_svipal
|
||||||
*/
|
*/
|
||||||
// we default to orthogonal
|
// we default to orthogonal
|
||||||
this.orientation = (orientation !== undefined) ? orientation : "orthogonal";
|
// we need to deep copy the string to prevent the orientation later going out of scope
|
||||||
|
if (orientation == undefined) {
|
||||||
// console.log("tile orientation : "+this.orientation)
|
this.orientation = "orthogonal";
|
||||||
|
} else {
|
||||||
|
this.orientation = orientation // (' ' + orientation).slice(1)
|
||||||
|
}
|
||||||
|
console.log("tile orientation : "+this.orientation)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12898,25 +12902,23 @@ var Tile = new Class({
|
||||||
*/
|
*/
|
||||||
updatePixelXY: function ()
|
updatePixelXY: function ()
|
||||||
{
|
{
|
||||||
// Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the
|
if (orientation === "orthogonal") {
|
||||||
|
// In orthogonal mode, Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the
|
||||||
// bottom left, while the Phaser renderer assumes the origin is the top left. The y
|
// bottom left, while the Phaser renderer assumes the origin is the top left. The y
|
||||||
// coordinate needs to be adjusted by the difference.
|
// coordinate needs to be adjusted by the difference.
|
||||||
console.log("width" + this.baseWidth)
|
|
||||||
console.log("height" + this.baseHeight)
|
|
||||||
if (this.orientation === "orthogonal") {
|
|
||||||
this.pixelX = this.x * this.baseWidth;
|
this.pixelX = this.x * this.baseWidth;
|
||||||
this.pixelY = this.y * this.baseHeight;
|
this.pixelY = this.y * this.baseHeight;
|
||||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||||
} else if (this.orientation === "isometric") {
|
} else if (orientation === "isometric" ) {
|
||||||
mapSize = 10
|
mapSize = 10
|
||||||
// once we get the 'top' of the losange we need to remove half of the tile width.
|
// once we get the 'top' of the losange we need to remove half of the tile width.
|
||||||
this.pixelX = (this.baseWidth/2)*mapSize + (this.x - this.y) * this.baseWidth *0.5;
|
this.pixelX = (this.baseWidth/2)*mapSize + (this.x - this.y) * this.baseWidth *0.5;
|
||||||
this.pixelY = (this.x + this.y) * this.baseHeight *0.5;
|
this.pixelY = (this.x + this.y) * this.baseHeight *0.5;
|
||||||
console.log("isopix "+this.pixelX+","+this.pixelY)
|
console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||||
console.log(this)
|
console.log(self)
|
||||||
} else {
|
} else {
|
||||||
console.log(this)
|
console.log("self :" + self)
|
||||||
console.log("tile orientation : "+this.orientation)
|
console.log("tile orientation 2: "+orientation)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
||||||
|
@ -102924,6 +102926,8 @@ var ParseTileLayers = function (json, insertNull)
|
||||||
// index, x, y, width, height
|
// index, x, y, width, height
|
||||||
if (gidInfo.gid > 0)
|
if (gidInfo.gid > 0)
|
||||||
{
|
{
|
||||||
|
console.log("Tile ptl 1", newOffsetX, newOffsetY, json.tilewidth,
|
||||||
|
json.tileheight,json.orientation)
|
||||||
tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth,
|
tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth,
|
||||||
json.tileheight,json.orientation);
|
json.tileheight,json.orientation);
|
||||||
|
|
||||||
|
@ -102936,6 +102940,8 @@ var ParseTileLayers = function (json, insertNull)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
console.log("Tile ptl 2", newOffsetX, newOffsetY, json.tilewidth,
|
||||||
|
json.tileheight,json.orientation)
|
||||||
blankTile = insertNull
|
blankTile = insertNull
|
||||||
? null
|
? null
|
||||||
: new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight,json.orientation);
|
: new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight,json.orientation);
|
||||||
|
@ -102978,6 +102984,8 @@ var ParseTileLayers = function (json, insertNull)
|
||||||
// index, x, y, width, height
|
// index, x, y, width, height
|
||||||
if (gidInfo.gid > 0)
|
if (gidInfo.gid > 0)
|
||||||
{
|
{
|
||||||
|
console.log("Tile ptl 3", newOffsetX, newOffsetY, json.tilewidth,
|
||||||
|
json.tileheight,json.orientation)
|
||||||
tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth,
|
tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth,
|
||||||
json.tileheight, json.orientation);
|
json.tileheight, json.orientation);
|
||||||
|
|
||||||
|
@ -102990,6 +102998,8 @@ var ParseTileLayers = function (json, insertNull)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
console.log("Tile ptl 4", newOffsetX, newOffsetY, json.tilewidth,
|
||||||
|
json.tileheight,json.orientation)
|
||||||
blankTile = insertNull
|
blankTile = insertNull
|
||||||
? null
|
? null
|
||||||
: new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight, json.orientation);
|
: new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight, json.orientation);
|
||||||
|
@ -104621,7 +104631,7 @@ var Tilemap = new Class({
|
||||||
|
|
||||||
for (var tileX = 0; tileX < width; tileX++)
|
for (var tileX = 0; tileX < width; tileX++)
|
||||||
{
|
{
|
||||||
console.log("Tile tm", tileX, tileY, tileWidth, tileHeight, this.tileWidth, this.tileHeight, this.orientation)
|
console.log("Tile tm", tileX, tileY, tileWidth, tileHeight, this.orientation, this.tileWidth, this.tileHeight)
|
||||||
row.push(new Tile(layerData, -1, tileX, tileY, tileWidth, tileHeight, this.orientation, this.tileWidth, this.tileHeight));
|
row.push(new Tile(layerData, -1, tileX, tileY, tileWidth, tileHeight, this.orientation, this.tileWidth, this.tileHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177177,7 +177187,6 @@ module.exports = {
|
||||||
*/
|
*/
|
||||||
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||||
{
|
{
|
||||||
console.log("webgl renderer")
|
|
||||||
var tilesets = src.tileset;
|
var tilesets = src.tileset;
|
||||||
|
|
||||||
var pipeline = src.pipeline;
|
var pipeline = src.pipeline;
|
||||||
|
@ -177249,7 +177258,6 @@ module.exports = StaticTilemapLayerWebGLRenderer;
|
||||||
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
src.cull(camera);
|
src.cull(camera);
|
||||||
console.log("canvas renderer")
|
|
||||||
var renderTiles = src.culledTiles;
|
var renderTiles = src.culledTiles;
|
||||||
var tileCount = renderTiles.length;
|
var tileCount = renderTiles.length;
|
||||||
|
|
||||||
|
|
2
dist/phaser-arcade-physics.min.js
vendored
2
dist/phaser-arcade-physics.min.js
vendored
File diff suppressed because one or more lines are too long
36
dist/phaser.js
vendored
36
dist/phaser.js
vendored
|
@ -14387,9 +14387,13 @@ var Tile = new Class({
|
||||||
* @since 3.2.PR_svipal
|
* @since 3.2.PR_svipal
|
||||||
*/
|
*/
|
||||||
// we default to orthogonal
|
// we default to orthogonal
|
||||||
this.orientation = (orientation !== undefined) ? orientation : "orthogonal";
|
// we need to deep copy the string to prevent the orientation later going out of scope
|
||||||
|
if (orientation == undefined) {
|
||||||
// console.log("tile orientation : "+this.orientation)
|
this.orientation = "orthogonal";
|
||||||
|
} else {
|
||||||
|
this.orientation = orientation // (' ' + orientation).slice(1)
|
||||||
|
}
|
||||||
|
console.log("tile orientation : "+this.orientation)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14822,25 +14826,23 @@ var Tile = new Class({
|
||||||
*/
|
*/
|
||||||
updatePixelXY: function ()
|
updatePixelXY: function ()
|
||||||
{
|
{
|
||||||
// Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the
|
if (orientation === "orthogonal") {
|
||||||
|
// In orthogonal mode, Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the
|
||||||
// bottom left, while the Phaser renderer assumes the origin is the top left. The y
|
// bottom left, while the Phaser renderer assumes the origin is the top left. The y
|
||||||
// coordinate needs to be adjusted by the difference.
|
// coordinate needs to be adjusted by the difference.
|
||||||
console.log("width" + this.baseWidth)
|
|
||||||
console.log("height" + this.baseHeight)
|
|
||||||
if (this.orientation === "orthogonal") {
|
|
||||||
this.pixelX = this.x * this.baseWidth;
|
this.pixelX = this.x * this.baseWidth;
|
||||||
this.pixelY = this.y * this.baseHeight;
|
this.pixelY = this.y * this.baseHeight;
|
||||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||||
} else if (this.orientation === "isometric") {
|
} else if (orientation === "isometric" ) {
|
||||||
mapSize = 10
|
mapSize = 10
|
||||||
// once we get the 'top' of the losange we need to remove half of the tile width.
|
// once we get the 'top' of the losange we need to remove half of the tile width.
|
||||||
this.pixelX = (this.baseWidth/2)*mapSize + (this.x - this.y) * this.baseWidth *0.5;
|
this.pixelX = (this.baseWidth/2)*mapSize + (this.x - this.y) * this.baseWidth *0.5;
|
||||||
this.pixelY = (this.x + this.y) * this.baseHeight *0.5;
|
this.pixelY = (this.x + this.y) * this.baseHeight *0.5;
|
||||||
console.log("isopix "+this.pixelX+","+this.pixelY)
|
console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||||
console.log(this)
|
console.log(self)
|
||||||
} else {
|
} else {
|
||||||
console.log(this)
|
console.log("self :" + self)
|
||||||
console.log("tile orientation : "+this.orientation)
|
console.log("tile orientation 2: "+orientation)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
||||||
|
@ -107735,6 +107737,8 @@ var ParseTileLayers = function (json, insertNull)
|
||||||
// index, x, y, width, height
|
// index, x, y, width, height
|
||||||
if (gidInfo.gid > 0)
|
if (gidInfo.gid > 0)
|
||||||
{
|
{
|
||||||
|
console.log("Tile ptl 1", newOffsetX, newOffsetY, json.tilewidth,
|
||||||
|
json.tileheight,json.orientation)
|
||||||
tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth,
|
tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth,
|
||||||
json.tileheight,json.orientation);
|
json.tileheight,json.orientation);
|
||||||
|
|
||||||
|
@ -107747,6 +107751,8 @@ var ParseTileLayers = function (json, insertNull)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
console.log("Tile ptl 2", newOffsetX, newOffsetY, json.tilewidth,
|
||||||
|
json.tileheight,json.orientation)
|
||||||
blankTile = insertNull
|
blankTile = insertNull
|
||||||
? null
|
? null
|
||||||
: new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight,json.orientation);
|
: new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight,json.orientation);
|
||||||
|
@ -107789,6 +107795,8 @@ var ParseTileLayers = function (json, insertNull)
|
||||||
// index, x, y, width, height
|
// index, x, y, width, height
|
||||||
if (gidInfo.gid > 0)
|
if (gidInfo.gid > 0)
|
||||||
{
|
{
|
||||||
|
console.log("Tile ptl 3", newOffsetX, newOffsetY, json.tilewidth,
|
||||||
|
json.tileheight,json.orientation)
|
||||||
tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth,
|
tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth,
|
||||||
json.tileheight, json.orientation);
|
json.tileheight, json.orientation);
|
||||||
|
|
||||||
|
@ -107801,6 +107809,8 @@ var ParseTileLayers = function (json, insertNull)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
console.log("Tile ptl 4", newOffsetX, newOffsetY, json.tilewidth,
|
||||||
|
json.tileheight,json.orientation)
|
||||||
blankTile = insertNull
|
blankTile = insertNull
|
||||||
? null
|
? null
|
||||||
: new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight, json.orientation);
|
: new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight, json.orientation);
|
||||||
|
@ -109432,7 +109442,7 @@ var Tilemap = new Class({
|
||||||
|
|
||||||
for (var tileX = 0; tileX < width; tileX++)
|
for (var tileX = 0; tileX < width; tileX++)
|
||||||
{
|
{
|
||||||
console.log("Tile tm", tileX, tileY, tileWidth, tileHeight, this.tileWidth, this.tileHeight, this.orientation)
|
console.log("Tile tm", tileX, tileY, tileWidth, tileHeight, this.orientation, this.tileWidth, this.tileHeight)
|
||||||
row.push(new Tile(layerData, -1, tileX, tileY, tileWidth, tileHeight, this.orientation, this.tileWidth, this.tileHeight));
|
row.push(new Tile(layerData, -1, tileX, tileY, tileWidth, tileHeight, this.orientation, this.tileWidth, this.tileHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185096,7 +185106,6 @@ module.exports = {
|
||||||
*/
|
*/
|
||||||
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||||
{
|
{
|
||||||
console.log("webgl renderer")
|
|
||||||
var tilesets = src.tileset;
|
var tilesets = src.tileset;
|
||||||
|
|
||||||
var pipeline = src.pipeline;
|
var pipeline = src.pipeline;
|
||||||
|
@ -185168,7 +185177,6 @@ module.exports = StaticTilemapLayerWebGLRenderer;
|
||||||
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
src.cull(camera);
|
src.cull(camera);
|
||||||
console.log("canvas renderer")
|
|
||||||
var renderTiles = src.culledTiles;
|
var renderTiles = src.culledTiles;
|
||||||
var tileCount = renderTiles.length;
|
var tileCount = renderTiles.length;
|
||||||
|
|
||||||
|
|
2
dist/phaser.min.js
vendored
2
dist/phaser.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -278,16 +278,20 @@ var Tile = new Class({
|
||||||
*/
|
*/
|
||||||
this.physics = {};
|
this.physics = {};
|
||||||
/**
|
/**
|
||||||
* An empty object where physics-engine specific information (e.g. bodies) may be stored.
|
* The tile's orientation, necessary to be able to determine pixelX and pixelY.
|
||||||
*
|
*
|
||||||
* @name Phaser.Tilemaps.Tile#orientation
|
* @name Phaser.Tilemaps.Tile#orientation
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @since 3.2.PR_svipal
|
* @since 3.2.PR_svipal
|
||||||
*/
|
*/
|
||||||
// we default to orthogonal
|
// we default to orthogonal
|
||||||
this.orientation = (orientation !== undefined) ? orientation : "orthogonal";
|
// we need to deep copy the string to prevent the orientation later going out of scope
|
||||||
|
if (orientation == undefined) {
|
||||||
// console.log("tile orientation : "+this.orientation)
|
this.orientation = "orthogonal";
|
||||||
|
} else {
|
||||||
|
this.orientation = (' ' + orientation).slice(1)
|
||||||
|
}
|
||||||
|
console.log("tile orientation : "+this.orientation)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -720,12 +724,11 @@ var Tile = new Class({
|
||||||
*/
|
*/
|
||||||
updatePixelXY: function ()
|
updatePixelXY: function ()
|
||||||
{
|
{
|
||||||
// Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the
|
console.log("tile orientation 2: "+this.orientation)
|
||||||
|
if (this.orientation === "orthogonal") {
|
||||||
|
// In orthogonal mode, Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the
|
||||||
// bottom left, while the Phaser renderer assumes the origin is the top left. The y
|
// bottom left, while the Phaser renderer assumes the origin is the top left. The y
|
||||||
// coordinate needs to be adjusted by the difference.
|
// coordinate needs to be adjusted by the difference.
|
||||||
console.log("width" + this.baseWidth)
|
|
||||||
console.log("height" + this.baseHeight)
|
|
||||||
if (this.orientation === "orthogonal") {
|
|
||||||
this.pixelX = this.x * this.baseWidth;
|
this.pixelX = this.x * this.baseWidth;
|
||||||
this.pixelY = this.y * this.baseHeight;
|
this.pixelY = this.y * this.baseHeight;
|
||||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||||
|
@ -737,8 +740,8 @@ var Tile = new Class({
|
||||||
console.log("isopix "+this.pixelX+","+this.pixelY)
|
console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||||
console.log(this)
|
console.log(this)
|
||||||
} else {
|
} else {
|
||||||
console.log(this)
|
console.log("this :" + this)
|
||||||
console.log("tile orientation : "+this.orientation)
|
console.log("tile orientation 3: "+this.orientation)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
src.cull(camera);
|
src.cull(camera);
|
||||||
console.log("canvas renderer")
|
|
||||||
var renderTiles = src.culledTiles;
|
var renderTiles = src.culledTiles;
|
||||||
var tileCount = renderTiles.length;
|
var tileCount = renderTiles.length;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||||
{
|
{
|
||||||
console.log("webgl renderer")
|
|
||||||
var tilesets = src.tileset;
|
var tilesets = src.tileset;
|
||||||
|
|
||||||
var pipeline = src.pipeline;
|
var pipeline = src.pipeline;
|
||||||
|
|
Loading…
Reference in a new issue