mirror of
https://github.com/photonstorm/phaser
synced 2025-01-09 19:58:52 +00:00
need to compare across commits to understand regression regarding this.x
This commit is contained in:
parent
208c77f3fd
commit
95d2ff9996
18 changed files with 5087 additions and 4021 deletions
4214
dist/phaser-arcade-physics.js
vendored
4214
dist/phaser-arcade-physics.js
vendored
File diff suppressed because it is too large
Load diff
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
4806
dist/phaser.js
vendored
4806
dist/phaser.js
vendored
File diff suppressed because it is too large
Load diff
2
dist/phaser.min.js
vendored
2
dist/phaser.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -22,6 +22,8 @@
|
|||
"buildfb": "webpack --config config/webpack.fb.config.js",
|
||||
"watchfb": "webpack --config config/webpack.fb.config.js --watch",
|
||||
"dist": "webpack --config config/webpack.dist.config.js",
|
||||
"distT": "webpack --config config/webpack.dist.config.js && npm run toT",
|
||||
"toT": "@powershell Copy-Item ./dist/phaser.min.js ../phasertest/phaser.min.js",
|
||||
"distfb": "webpack --config config/webpack.fb.dist.config.js",
|
||||
"distfull": "npm run dist && npm run distfb",
|
||||
"plugin.cam3d": "webpack --config plugins/camera3d/webpack.config.js",
|
||||
|
|
|
@ -77,6 +77,7 @@ var Tile = new Class({
|
|||
* @since 3.0.0
|
||||
*/
|
||||
this.x = x;
|
||||
console.log("tile x : " + x)
|
||||
|
||||
/**
|
||||
* The y map coordinate of this tile in tile units.
|
||||
|
@ -284,6 +285,7 @@ var Tile = new Class({
|
|||
* @since 3.2.PR_svipal
|
||||
*/
|
||||
this.orientation = orientation
|
||||
console.log("tile orientation : "+this.orientation)
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -719,14 +721,16 @@ var Tile = new Class({
|
|||
// 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.
|
||||
if (this.orientation = "orthogonal") {
|
||||
if (this.orientation === "orthogonal" || true) {
|
||||
this.pixelX = this.x * this.baseWidth;
|
||||
this.pixelY = this.y * this.baseHeight;
|
||||
} else if (this.orientation = "isometric") {
|
||||
console.log("isopix")
|
||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||
} else /*if (this.orientation === "isometric")*/ {
|
||||
|
||||
// once we get the 'top' of the losange we need to remove half of the tile width.
|
||||
this.pixelX = (this.x - this.y) * this.baseWidth / 2;
|
||||
this.pixelY = (this.x + this.y) * this.baseHeight / 2;
|
||||
this.pixelX = (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)
|
||||
}
|
||||
|
||||
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
|
||||
|
|
|
@ -135,6 +135,7 @@ var Tilemap = new Class({
|
|||
* @since 3.0.0
|
||||
*/
|
||||
this.orientation = mapData.orientation;
|
||||
console.log("map orientation :" + this.orientation)
|
||||
|
||||
/**
|
||||
* The render (draw) order of the map data (as specified in Tiled), usually 'right-down'.
|
||||
|
|
|
@ -24,10 +24,11 @@ var SetTileCollision = require('./SetTileCollision');
|
|||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer, orientation)
|
||||
{
|
||||
if (!IsInLayerBounds(tileX, tileY, layer)) { return null; }
|
||||
if (recalculateFaces === undefined) { recalculateFaces = true; }
|
||||
|
@ -39,7 +40,7 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
|
|||
{
|
||||
if (layer.data[tileY][tileX] === null)
|
||||
{
|
||||
layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height);
|
||||
layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height, orientation);
|
||||
}
|
||||
layer.data[tileY][tileX].copy(tile);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* //Instinct : mistake to put it there
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer, orientation)
|
||||
|
|
|
@ -23,8 +23,10 @@ var PutTileAt = require('./PutTileAt');
|
|||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*/
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer)
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer, orientation)
|
||||
{
|
||||
if (!Array.isArray(tilesArray)) { return null; }
|
||||
if (recalculateFaces === undefined) { recalculateFaces = true; }
|
||||
|
@ -43,7 +45,7 @@ var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer)
|
|||
for (var tx = 0; tx < width; tx++)
|
||||
{
|
||||
var tile = tilesArray[ty][tx];
|
||||
PutTileAt(tile, tileX + tx, tileY + ty, false, layer);
|
||||
PutTileAt(tile, tileX + tx, tileY + ty, false, layer, orientation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer,
|
|||
if (orientation === "orthogonal") {
|
||||
point.x = WorldToTileX(worldX, snapToFloor, camera, layer, orientation);
|
||||
point.y = WorldToTileY(worldY, snapToFloor, camera, layer, orientation);
|
||||
} else if (orientation == 'isometric') {
|
||||
} else if (orientation === 'isometric') {
|
||||
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
|
|
|
@ -750,7 +750,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTileAt: function (tile, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer);
|
||||
return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer, this.tilemap.orientation);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -794,7 +794,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer);
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer, this.tilemap.orientation);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
|
@ -117,7 +117,7 @@ var MapData = new Class({
|
|||
* @since 3.0.0
|
||||
*/
|
||||
this.orientation = GetFastValue(config, 'orientation', 'orthogonal');
|
||||
|
||||
console.log("map data orientation : " + this.orientation)
|
||||
/**
|
||||
* Determines the draw order of tilemap. Default is right-down
|
||||
*
|
||||
|
|
|
@ -34,7 +34,7 @@ var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull)
|
|||
tileWidth: tileWidth,
|
||||
tileHeight: tileHeight
|
||||
});
|
||||
|
||||
console.log("parsing 2D array")
|
||||
var mapData = new MapData({
|
||||
name: name,
|
||||
tileWidth: tileWidth,
|
||||
|
|
|
@ -32,11 +32,14 @@ var AssignTileProperties = require('./AssignTileProperties');
|
|||
*/
|
||||
var ParseJSONTiled = function (name, json, insertNull)
|
||||
{
|
||||
// if (json.orientation !== 'orthogonal')
|
||||
// {
|
||||
// console.warn('Only orthogonal map types are supported in this version of Phaser');
|
||||
// return null;
|
||||
// }
|
||||
if (json.orientation == 'isometric')
|
||||
{
|
||||
console.warn('isometric map types are WIP in this version of Phaser');
|
||||
|
||||
} else if (json.orientation == 'orthogonal') {
|
||||
console.warn('Only orthogonal map types are supported in this version of Phaser');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Map data will consist of: layers, objects, images, tilesets, sizes
|
||||
var mapData = new MapData({
|
||||
|
|
|
@ -160,7 +160,7 @@ var ParseTileLayers = function (json, insertNull)
|
|||
if (gidInfo.gid > 0)
|
||||
{
|
||||
tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth,
|
||||
json.tileheight);
|
||||
json.tileheight,json.orientation);
|
||||
|
||||
// Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal
|
||||
// propeties into flipX, flipY and rotation
|
||||
|
@ -173,7 +173,7 @@ var ParseTileLayers = function (json, insertNull)
|
|||
{
|
||||
blankTile = insertNull
|
||||
? null
|
||||
: new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight);
|
||||
: new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight,json.orientation);
|
||||
|
||||
output[newOffsetY][newOffsetX] = blankTile;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ var ParseTileLayers = function (json, insertNull)
|
|||
if (gidInfo.gid > 0)
|
||||
{
|
||||
tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth,
|
||||
json.tileheight);
|
||||
json.tileheight, json.orientation);
|
||||
|
||||
// Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal
|
||||
// propeties into flipX, flipY and rotation
|
||||
|
@ -227,7 +227,7 @@ var ParseTileLayers = function (json, insertNull)
|
|||
{
|
||||
blankTile = insertNull
|
||||
? null
|
||||
: new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight);
|
||||
: new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight, json.orientation);
|
||||
row.push(blankTile);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
src.cull(camera);
|
||||
|
||||
console.log("canvas renderer")
|
||||
var renderTiles = src.culledTiles;
|
||||
var tileCount = renderTiles.length;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
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