fixed worldToTileXY and tileToWorldXY undefined point mistakes. Fixed getTilesWithinXY incorrect snaptoFloor setting

This commit is contained in:
Svipal 2020-02-07 14:05:42 +01:00
parent dc330aaf4a
commit d7a857697f
17 changed files with 11059 additions and 15387 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

15665
dist/phaser.js vendored

File diff suppressed because it is too large Load diff

2
dist/phaser.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "phaser",
"version": "3.23.0-beta1",
"version": "3.23.0-betaSvipal",
"release": "Ginro",
"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)",
@ -22,8 +22,10 @@
"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",
"distT": "webpack --config config/webpack.dist.config.js && npm run toT1 && npm run toT2 && npm run toT3",
"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",
"distfull": "npm run dist && npm run distfb",
"plugin.cam3d": "webpack --config plugins/camera3d/webpack.config.js",

View file

@ -18,7 +18,6 @@
var TileIntersectsBody = function (tileWorldRect, body)
{
// Currently, all bodies are treated as rectangles when colliding with a Tile.
return !(
body.right <= tileWorldRect.left ||
body.bottom <= tileWorldRect.top ||

View file

@ -47,7 +47,7 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came
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.y = point.y;
var sprite = scene.make.sprite(spriteConfig);

View file

@ -70,7 +70,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
inIsoBounds = function (x,y)
{
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);
};
}
}

View file

@ -39,6 +39,7 @@ var GetTileAt = function (tileX, tileY, nonNull, layer)
else
{
return tile;
}
}

View file

@ -25,7 +25,7 @@ var WorldToTileXY = require('./WorldToTileXY');
*/
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 tileY = point.y;
return GetTileAt(tileX, tileY, nonNull, layer);

View file

@ -49,12 +49,12 @@ var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
else if (shape instanceof Geom.Line) { intersectTest = Intersects.LineToRectangle; }
// 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 yStart = pointStart.y;
// 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 yEnd = Math.ceil(pointEnd.y);
@ -77,7 +77,7 @@ var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
for (var i = 0; i < tiles.length; 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.y = point.y;
if (intersectTest(shape, tileRect))

View file

@ -29,15 +29,14 @@ var WorldToTileXY = require('./WorldToTileXY');
*/
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
var pointStart = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
var pointStart = WorldToTileXY(worldX, worldY, true, undefined, camera, layer);
var xStart = pointStart.x;
var yStart = pointStart.y;
// 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 yEnd = Math.ceil(pointEnd.y);

View file

@ -24,7 +24,7 @@ var WorldToTileXY = require('./WorldToTileXY');
*/
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 tileY = point.y;
return HasTileAt(tileX, tileY, layer);

View file

@ -28,7 +28,7 @@ var WorldToTileXY = require('./WorldToTileXY');
*/
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 tileY = point.y;
return PutTileAt(tile, tileX, tileY, recalculateFaces, layer);

View file

@ -26,7 +26,7 @@ var WorldToTileXY = require('./WorldToTileXY');
*/
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 tileY = point.y;
return RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer);

View file

@ -110,11 +110,11 @@ var LayerData = new Class({
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
* @type {string}
* @since 3.22.PR_svipal
* @since 3.23beta.PR_svipal
*/
this.orientation = GetFastValue(config, 'orientation', 'orthogonal');

View file

@ -117,7 +117,6 @@ 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