mirror of
https://github.com/photonstorm/phaser
synced 2024-12-23 03:23:42 +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
|
||||
*/
|
||||
// we default to orthogonal
|
||||
this.orientation = (orientation !== undefined) ? orientation : "orthogonal";
|
||||
|
||||
// console.log("tile orientation : "+this.orientation)
|
||||
// we need to deep copy the string to prevent the orientation later going out of scope
|
||||
if (orientation == undefined) {
|
||||
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 ()
|
||||
{
|
||||
// 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
|
||||
// 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.pixelY = this.y * this.baseHeight;
|
||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||
} else if (this.orientation === "isometric") {
|
||||
} else if (orientation === "isometric" ) {
|
||||
mapSize = 10
|
||||
// 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.pixelY = (this.x + this.y) * this.baseHeight *0.5;
|
||||
console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||
console.log(this)
|
||||
console.log(self)
|
||||
} else {
|
||||
console.log(this)
|
||||
console.log("tile orientation : "+this.orientation)
|
||||
console.log("self :" + self)
|
||||
console.log("tile orientation 2: "+orientation)
|
||||
}
|
||||
|
||||
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
||||
|
@ -102924,6 +102926,8 @@ var ParseTileLayers = function (json, insertNull)
|
|||
// index, x, y, width, height
|
||||
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,
|
||||
json.tileheight,json.orientation);
|
||||
|
||||
|
@ -102936,6 +102940,8 @@ var ParseTileLayers = function (json, insertNull)
|
|||
}
|
||||
else
|
||||
{
|
||||
console.log("Tile ptl 2", newOffsetX, newOffsetY, json.tilewidth,
|
||||
json.tileheight,json.orientation)
|
||||
blankTile = insertNull
|
||||
? null
|
||||
: 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
|
||||
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,
|
||||
json.tileheight, json.orientation);
|
||||
|
||||
|
@ -102990,6 +102998,8 @@ var ParseTileLayers = function (json, insertNull)
|
|||
}
|
||||
else
|
||||
{
|
||||
console.log("Tile ptl 4", newOffsetX, newOffsetY, json.tilewidth,
|
||||
json.tileheight,json.orientation)
|
||||
blankTile = insertNull
|
||||
? null
|
||||
: 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++)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -177177,7 +177187,6 @@ module.exports = {
|
|||
*/
|
||||
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||
{
|
||||
console.log("webgl renderer")
|
||||
var tilesets = src.tileset;
|
||||
|
||||
var pipeline = src.pipeline;
|
||||
|
@ -177249,7 +177258,6 @@ module.exports = StaticTilemapLayerWebGLRenderer;
|
|||
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
src.cull(camera);
|
||||
console.log("canvas renderer")
|
||||
var renderTiles = src.culledTiles;
|
||||
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
|
||||
*/
|
||||
// we default to orthogonal
|
||||
this.orientation = (orientation !== undefined) ? orientation : "orthogonal";
|
||||
|
||||
// console.log("tile orientation : "+this.orientation)
|
||||
// we need to deep copy the string to prevent the orientation later going out of scope
|
||||
if (orientation == undefined) {
|
||||
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 ()
|
||||
{
|
||||
// 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
|
||||
// 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.pixelY = this.y * this.baseHeight;
|
||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||
} else if (this.orientation === "isometric") {
|
||||
} else if (orientation === "isometric" ) {
|
||||
mapSize = 10
|
||||
// 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.pixelY = (this.x + this.y) * this.baseHeight *0.5;
|
||||
console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||
console.log(this)
|
||||
console.log(self)
|
||||
} else {
|
||||
console.log(this)
|
||||
console.log("tile orientation : "+this.orientation)
|
||||
console.log("self :" + self)
|
||||
console.log("tile orientation 2: "+orientation)
|
||||
}
|
||||
|
||||
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
||||
|
@ -107735,6 +107737,8 @@ var ParseTileLayers = function (json, insertNull)
|
|||
// index, x, y, width, height
|
||||
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,
|
||||
json.tileheight,json.orientation);
|
||||
|
||||
|
@ -107747,6 +107751,8 @@ var ParseTileLayers = function (json, insertNull)
|
|||
}
|
||||
else
|
||||
{
|
||||
console.log("Tile ptl 2", newOffsetX, newOffsetY, json.tilewidth,
|
||||
json.tileheight,json.orientation)
|
||||
blankTile = insertNull
|
||||
? null
|
||||
: 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
|
||||
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,
|
||||
json.tileheight, json.orientation);
|
||||
|
||||
|
@ -107801,6 +107809,8 @@ var ParseTileLayers = function (json, insertNull)
|
|||
}
|
||||
else
|
||||
{
|
||||
console.log("Tile ptl 4", newOffsetX, newOffsetY, json.tilewidth,
|
||||
json.tileheight,json.orientation)
|
||||
blankTile = insertNull
|
||||
? null
|
||||
: 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++)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -185096,7 +185106,6 @@ module.exports = {
|
|||
*/
|
||||
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||
{
|
||||
console.log("webgl renderer")
|
||||
var tilesets = src.tileset;
|
||||
|
||||
var pipeline = src.pipeline;
|
||||
|
@ -185168,7 +185177,6 @@ module.exports = StaticTilemapLayerWebGLRenderer;
|
|||
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
src.cull(camera);
|
||||
console.log("canvas renderer")
|
||||
var renderTiles = src.culledTiles;
|
||||
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 = {};
|
||||
/**
|
||||
* 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
|
||||
* @type {string}
|
||||
* @since 3.2.PR_svipal
|
||||
*/
|
||||
// we default to orthogonal
|
||||
this.orientation = (orientation !== undefined) ? orientation : "orthogonal";
|
||||
|
||||
// console.log("tile orientation : "+this.orientation)
|
||||
// we need to deep copy the string to prevent the orientation later going out of scope
|
||||
if (orientation == undefined) {
|
||||
this.orientation = "orthogonal";
|
||||
} else {
|
||||
this.orientation = (' ' + orientation).slice(1)
|
||||
}
|
||||
console.log("tile orientation : "+this.orientation)
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -720,16 +724,15 @@ var Tile = new Class({
|
|||
*/
|
||||
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
|
||||
// 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.pixelY = this.y * this.baseHeight;
|
||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||
} else if (this.orientation === "isometric") {
|
||||
} else if (this.orientation === "isometric" ) {
|
||||
mapSize = 10
|
||||
// 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;
|
||||
|
@ -737,8 +740,8 @@ var Tile = new Class({
|
|||
console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||
console.log(this)
|
||||
} else {
|
||||
console.log(this)
|
||||
console.log("tile orientation : "+this.orientation)
|
||||
console.log("this :" + this)
|
||||
console.log("tile orientation 3: "+this.orientation)
|
||||
}
|
||||
|
||||
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
src.cull(camera);
|
||||
console.log("canvas renderer")
|
||||
var renderTiles = src.culledTiles;
|
||||
var tileCount = renderTiles.length;
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||
{
|
||||
console.log("webgl renderer")
|
||||
var tilesets = src.tileset;
|
||||
|
||||
var pipeline = src.pipeline;
|
||||
|
|
Loading…
Reference in a new issue