mirror of
https://github.com/photonstorm/phaser
synced 2025-01-10 04:08:50 +00:00
fixed worldToTileXY and tileToWorldXY undefined point mistakes. Fixed getTilesWithinXY incorrect snaptoFloor setting
This commit is contained in:
parent
dc330aaf4a
commit
d7a857697f
17 changed files with 11059 additions and 15387 deletions
10625
dist/phaser-arcade-physics.js
vendored
10625
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
15763
dist/phaser.js
vendored
15763
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
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "phaser",
|
"name": "phaser",
|
||||||
"version": "3.23.0-beta1",
|
"version": "3.23.0-betaSvipal",
|
||||||
"release": "Ginro",
|
"release": "Ginro",
|
||||||
"description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.",
|
"description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.",
|
||||||
"author": "Richard Davey <rich@photonstorm.com> (http://www.photonstorm.com)",
|
"author": "Richard Davey <rich@photonstorm.com> (http://www.photonstorm.com)",
|
||||||
|
@ -22,8 +22,10 @@
|
||||||
"buildfb": "webpack --config config/webpack.fb.config.js",
|
"buildfb": "webpack --config config/webpack.fb.config.js",
|
||||||
"watchfb": "webpack --config config/webpack.fb.config.js --watch",
|
"watchfb": "webpack --config config/webpack.fb.config.js --watch",
|
||||||
"dist": "webpack --config config/webpack.dist.config.js",
|
"dist": "webpack --config config/webpack.dist.config.js",
|
||||||
"distT": "webpack --config config/webpack.dist.config.js && npm run toT",
|
"distT": "webpack --config config/webpack.dist.config.js && npm run toT1 && npm run toT2 && npm run toT3",
|
||||||
"toT": "@powershell Copy-Item ./dist/phaser.min.js ../phasertest/phaser.min.js",
|
"toT1": "@powershell Copy-Item ./dist/phaser.min.js ../phasertest/phaser.min.js",
|
||||||
|
"toT2": "@powershell Copy-Item ./dist/phaser.min.js ../orthotest/phaser.min.js",
|
||||||
|
"toT3": "@powershell Copy-Item ./dist/phaser.min.js ../othertutorial/phaser.min.js ",
|
||||||
"distfb": "webpack --config config/webpack.fb.dist.config.js",
|
"distfb": "webpack --config config/webpack.fb.dist.config.js",
|
||||||
"distfull": "npm run dist && npm run distfb",
|
"distfull": "npm run dist && npm run distfb",
|
||||||
"plugin.cam3d": "webpack --config plugins/camera3d/webpack.config.js",
|
"plugin.cam3d": "webpack --config plugins/camera3d/webpack.config.js",
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
var TileIntersectsBody = function (tileWorldRect, body)
|
var TileIntersectsBody = function (tileWorldRect, body)
|
||||||
{
|
{
|
||||||
// Currently, all bodies are treated as rectangles when colliding with a Tile.
|
// Currently, all bodies are treated as rectangles when colliding with a Tile.
|
||||||
|
|
||||||
return !(
|
return !(
|
||||||
body.right <= tileWorldRect.left ||
|
body.right <= tileWorldRect.left ||
|
||||||
body.bottom <= tileWorldRect.top ||
|
body.bottom <= tileWorldRect.top ||
|
||||||
|
|
|
@ -47,7 +47,7 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came
|
||||||
|
|
||||||
if (indexes.indexOf(tile.index) !== -1)
|
if (indexes.indexOf(tile.index) !== -1)
|
||||||
{
|
{
|
||||||
var point = TileToWorldXY(tile.x,tile.y, camera, layer);
|
var point = TileToWorldXY(tile.x,tile.y, undefined, camera, layer);
|
||||||
spriteConfig.x = point.x;
|
spriteConfig.x = point.x;
|
||||||
spriteConfig.y = point.y;
|
spriteConfig.y = point.y;
|
||||||
var sprite = scene.make.sprite(spriteConfig);
|
var sprite = scene.make.sprite(spriteConfig);
|
||||||
|
|
|
@ -70,7 +70,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
|
||||||
inIsoBounds = function (x,y)
|
inIsoBounds = function (x,y)
|
||||||
{
|
{
|
||||||
var pos = tilemapLayer.tileToWorldXY(x,y,undefined,camera);
|
var pos = tilemapLayer.tileToWorldXY(x,y,undefined,camera);
|
||||||
return (pos.x > camera.worldView.x && pos.x < camera.worldView.right) && (pos.y > camera.worldView.y && pos.y < camera.worldView.bottom);
|
return (pos.x > camera.worldView.x && pos.x < camera.worldView.right - layer.tileWidth) && (pos.y > camera.worldView.y && pos.y < camera.worldView.bottom - layer.tileHeight);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ var GetTileAt = function (tileX, tileY, nonNull, layer)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return tile;
|
return tile;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ var WorldToTileXY = require('./WorldToTileXY');
|
||||||
*/
|
*/
|
||||||
var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer)
|
var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer)
|
||||||
{
|
{
|
||||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
var point = WorldToTileXY(worldX, worldY, true, undefined, camera, layer);
|
||||||
var tileX = point.x;
|
var tileX = point.x;
|
||||||
var tileY = point.y;
|
var tileY = point.y;
|
||||||
return GetTileAt(tileX, tileY, nonNull, layer);
|
return GetTileAt(tileX, tileY, nonNull, layer);
|
||||||
|
|
|
@ -49,12 +49,12 @@ var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
|
||||||
else if (shape instanceof Geom.Line) { intersectTest = Intersects.LineToRectangle; }
|
else if (shape instanceof Geom.Line) { intersectTest = Intersects.LineToRectangle; }
|
||||||
|
|
||||||
// Top left corner of the shapes's bounding box, rounded down to include partial tiles
|
// Top left corner of the shapes's bounding box, rounded down to include partial tiles
|
||||||
var pointStart = WorldToTileXY(shape.left, shape.top, true, camera, layer);
|
var pointStart = WorldToTileXY(shape.left, shape.top, true, undefined, camera, layer);
|
||||||
var xStart = pointStart.x;
|
var xStart = pointStart.x;
|
||||||
var yStart = pointStart.y;
|
var yStart = pointStart.y;
|
||||||
|
|
||||||
// Bottom right corner of the shapes's bounding box, rounded up to include partial tiles
|
// Bottom right corner of the shapes's bounding box, rounded up to include partial tiles
|
||||||
var pointEnd = WorldToTileXY(shape.right, shape.bottom, true, camera, layer);
|
var pointEnd = WorldToTileXY(shape.right, shape.bottom, true, undefined, camera, layer);
|
||||||
var xEnd = Math.ceil(pointEnd.x);
|
var xEnd = Math.ceil(pointEnd.x);
|
||||||
var yEnd = Math.ceil(pointEnd.y);
|
var yEnd = Math.ceil(pointEnd.y);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
|
||||||
for (var i = 0; i < tiles.length; i++)
|
for (var i = 0; i < tiles.length; i++)
|
||||||
{
|
{
|
||||||
var tile = tiles[i];
|
var tile = tiles[i];
|
||||||
var point = TileToWorldXY(tile.x, tile.y, camera, layer);
|
var point = TileToWorldXY(tile.x, tile.y, undefined, camera, layer);
|
||||||
tileRect.x = point.x;
|
tileRect.x = point.x;
|
||||||
tileRect.y = point.y;
|
tileRect.y = point.y;
|
||||||
if (intersectTest(shape, tileRect))
|
if (intersectTest(shape, tileRect))
|
||||||
|
|
|
@ -29,15 +29,14 @@ var WorldToTileXY = require('./WorldToTileXY');
|
||||||
*/
|
*/
|
||||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer)
|
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer)
|
||||||
{
|
{
|
||||||
var orientation = layer.orientation;
|
|
||||||
|
|
||||||
// Top left corner of the rect, rounded down to include partial tiles
|
// Top left corner of the rect, rounded down to include partial tiles
|
||||||
var pointStart = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
var pointStart = WorldToTileXY(worldX, worldY, true, undefined, camera, layer);
|
||||||
var xStart = pointStart.x;
|
var xStart = pointStart.x;
|
||||||
var yStart = pointStart.y;
|
var yStart = pointStart.y;
|
||||||
|
|
||||||
// Bottom right corner of the rect, rounded up to include partial tiles
|
// Bottom right corner of the rect, rounded up to include partial tiles
|
||||||
var pointEnd = WorldToTileXY(worldX + width, worldY + height, true, camera, layer, orientation);
|
var pointEnd = WorldToTileXY(worldX + width, worldY + height, false, undefined, camera, layer);
|
||||||
var xEnd = Math.ceil(pointEnd.x);
|
var xEnd = Math.ceil(pointEnd.x);
|
||||||
var yEnd = Math.ceil(pointEnd.y);
|
var yEnd = Math.ceil(pointEnd.y);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ var WorldToTileXY = require('./WorldToTileXY');
|
||||||
*/
|
*/
|
||||||
var HasTileAtWorldXY = function (worldX, worldY, camera, layer)
|
var HasTileAtWorldXY = function (worldX, worldY, camera, layer)
|
||||||
{
|
{
|
||||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
var point = WorldToTileXY(worldX, worldY, true, undefined, camera, layer);
|
||||||
var tileX = point.x;
|
var tileX = point.x;
|
||||||
var tileY = point.y;
|
var tileY = point.y;
|
||||||
return HasTileAt(tileX, tileY, layer);
|
return HasTileAt(tileX, tileY, layer);
|
||||||
|
|
|
@ -28,7 +28,7 @@ var WorldToTileXY = require('./WorldToTileXY');
|
||||||
*/
|
*/
|
||||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer)
|
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer)
|
||||||
{
|
{
|
||||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
var point = WorldToTileXY(worldX, worldY, true, undefined, camera, layer);
|
||||||
var tileX = point.x;
|
var tileX = point.x;
|
||||||
var tileY = point.y;
|
var tileY = point.y;
|
||||||
return PutTileAt(tile, tileX, tileY, recalculateFaces, layer);
|
return PutTileAt(tile, tileX, tileY, recalculateFaces, layer);
|
||||||
|
|
|
@ -26,7 +26,7 @@ var WorldToTileXY = require('./WorldToTileXY');
|
||||||
*/
|
*/
|
||||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer)
|
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer)
|
||||||
{
|
{
|
||||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
var point = WorldToTileXY(worldX, worldY, true, undefined, camera, layer);
|
||||||
var tileX = point.x;
|
var tileX = point.x;
|
||||||
var tileY = point.y;
|
var tileY = point.y;
|
||||||
return RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer);
|
return RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer);
|
||||||
|
|
|
@ -110,11 +110,11 @@ var LayerData = new Class({
|
||||||
this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight);
|
this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The layer's orientation, necessary to be able to determine q tile's pixelX and pixelY as well as the layer's width and height.
|
* The layer's orientation, necessary to be able to determine a tile's pixelX and pixelY as well as the layer's width and height.
|
||||||
*
|
*
|
||||||
* @name Phaser.Tilemaps.LayerData#orientation
|
* @name Phaser.Tilemaps.LayerData#orientation
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @since 3.22.PR_svipal
|
* @since 3.23beta.PR_svipal
|
||||||
*/
|
*/
|
||||||
this.orientation = GetFastValue(config, 'orientation', 'orthogonal');
|
this.orientation = GetFastValue(config, 'orientation', 'orthogonal');
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,6 @@ var MapData = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
this.orientation = GetFastValue(config, 'orientation', 'orthogonal');
|
this.orientation = GetFastValue(config, 'orientation', 'orthogonal');
|
||||||
console.log('map data orientation : ' + this.orientation);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the draw order of tilemap. Default is right-down
|
* Determines the draw order of tilemap. Default is right-down
|
||||||
|
|
Loading…
Reference in a new issue