removed a few debug prints, moved isoBounds to a new component, started to add constants

This commit is contained in:
Svipal 2020-03-22 12:35:24 +01:00
parent 33daee1d27
commit 1ccc815ce7
9 changed files with 552 additions and 468 deletions

Binary file not shown.

View file

@ -91,7 +91,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ /******/
/******/ /******/
/******/ // Load entry module and return exports /******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1427); /******/ return __webpack_require__(__webpack_require__.s = 1428);
/******/ }) /******/ })
/************************************************************************/ /************************************************************************/
/******/ ([ /******/ ([
@ -12722,31 +12722,19 @@ var Tile = new Class({
// this is crucial for wordtotile, tiletoworld to work. // this is crucial for wordtotile, tiletoworld to work.
this.pixelX = (this.x - this.y) * this.baseWidth * 0.5; this.pixelX = (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;
} }
else if (this.layer.orientation === 'staggered') else if (this.layer.orientation === 'staggered')
{ {
var tmap = this.layer.tilemapLayer.tilemap;
this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2);
this.pixelY = this.y * (this.baseHeight / 2); this.pixelY = this.y * (this.baseHeight / 2);
} }
else if (this.layer.orientation === 'hexagonal') else if (this.layer.orientation === 'hexagonal')
{ {
// var tmap = this.layer.tilemapLayer.tilemap;
console.log(this.layer.hexSideLength);
var sidel = this.layer.hexSideLength; var sidel = this.layer.hexSideLength;
var rowHeight = ((this.baseHeight - sidel) / 2 + sidel); var rowHeight = ((this.baseHeight - sidel) / 2 + sidel);
this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2);
this.pixelY = this.y * rowHeight; this.pixelY = this.y * rowHeight;
console.log('hexapix', this.pixelX, this.pixelY);
} }
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
console.log(this.layer);
return this; return this;
}, },
@ -26571,40 +26559,40 @@ module.exports = {
Copy: __webpack_require__(1307), Copy: __webpack_require__(1307),
CreateFromTiles: __webpack_require__(1308), CreateFromTiles: __webpack_require__(1308),
CullTiles: __webpack_require__(1309), CullTiles: __webpack_require__(1309),
Fill: __webpack_require__(1310), Fill: __webpack_require__(1311),
FilterTiles: __webpack_require__(1311), FilterTiles: __webpack_require__(1312),
FindByIndex: __webpack_require__(1312), FindByIndex: __webpack_require__(1313),
FindTile: __webpack_require__(1313), FindTile: __webpack_require__(1314),
ForEachTile: __webpack_require__(1314), ForEachTile: __webpack_require__(1315),
GetTileAt: __webpack_require__(137), GetTileAt: __webpack_require__(137),
GetTileAtWorldXY: __webpack_require__(1315), GetTileAtWorldXY: __webpack_require__(1316),
GetTilesWithin: __webpack_require__(24), GetTilesWithin: __webpack_require__(24),
GetTilesWithinShape: __webpack_require__(1316), GetTilesWithinShape: __webpack_require__(1317),
GetTilesWithinWorldXY: __webpack_require__(1317), GetTilesWithinWorldXY: __webpack_require__(1318),
HasTileAt: __webpack_require__(475), HasTileAt: __webpack_require__(475),
HasTileAtWorldXY: __webpack_require__(1318), HasTileAtWorldXY: __webpack_require__(1319),
IsInLayerBounds: __webpack_require__(100), IsInLayerBounds: __webpack_require__(100),
PutTileAt: __webpack_require__(218), PutTileAt: __webpack_require__(218),
PutTileAtWorldXY: __webpack_require__(1319), PutTileAtWorldXY: __webpack_require__(1320),
PutTilesAt: __webpack_require__(1320), PutTilesAt: __webpack_require__(1321),
Randomize: __webpack_require__(1321), Randomize: __webpack_require__(1322),
RemoveTileAt: __webpack_require__(476), RemoveTileAt: __webpack_require__(476),
RemoveTileAtWorldXY: __webpack_require__(1322), RemoveTileAtWorldXY: __webpack_require__(1323),
RenderDebug: __webpack_require__(1323), RenderDebug: __webpack_require__(1324),
ReplaceByIndex: __webpack_require__(472), ReplaceByIndex: __webpack_require__(472),
SetCollision: __webpack_require__(1324), SetCollision: __webpack_require__(1325),
SetCollisionBetween: __webpack_require__(1325), SetCollisionBetween: __webpack_require__(1326),
SetCollisionByExclusion: __webpack_require__(1326), SetCollisionByExclusion: __webpack_require__(1327),
SetCollisionByProperty: __webpack_require__(1327), SetCollisionByProperty: __webpack_require__(1328),
SetCollisionFromCollisionGroup: __webpack_require__(1328), SetCollisionFromCollisionGroup: __webpack_require__(1329),
SetTileIndexCallback: __webpack_require__(1329), SetTileIndexCallback: __webpack_require__(1330),
SetTileLocationCallback: __webpack_require__(1330), SetTileLocationCallback: __webpack_require__(1331),
Shuffle: __webpack_require__(1331), Shuffle: __webpack_require__(1332),
SwapByIndex: __webpack_require__(1332), SwapByIndex: __webpack_require__(1333),
TileToWorldX: __webpack_require__(470), TileToWorldX: __webpack_require__(470),
TileToWorldXY: __webpack_require__(217), TileToWorldXY: __webpack_require__(217),
TileToWorldY: __webpack_require__(471), TileToWorldY: __webpack_require__(471),
WeightedRandomize: __webpack_require__(1333), WeightedRandomize: __webpack_require__(1334),
WorldToTileX: __webpack_require__(473), WorldToTileX: __webpack_require__(473),
WorldToTileXY: __webpack_require__(72), WorldToTileXY: __webpack_require__(72),
WorldToTileY: __webpack_require__(474) WorldToTileY: __webpack_require__(474)
@ -47902,7 +47890,6 @@ var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height,
if (mapData === null) if (mapData === null)
{ {
console.log('null mapdata');
mapData = new MapData({ mapData = new MapData({
tileWidth: tileWidth, tileWidth: tileWidth,
tileHeight: tileHeight, tileHeight: tileHeight,
@ -49938,19 +49925,19 @@ module.exports = Tween;
module.exports = { module.exports = {
TIMELINE_COMPLETE: __webpack_require__(1350), TIMELINE_COMPLETE: __webpack_require__(1351),
TIMELINE_LOOP: __webpack_require__(1351), TIMELINE_LOOP: __webpack_require__(1352),
TIMELINE_PAUSE: __webpack_require__(1352), TIMELINE_PAUSE: __webpack_require__(1353),
TIMELINE_RESUME: __webpack_require__(1353), TIMELINE_RESUME: __webpack_require__(1354),
TIMELINE_START: __webpack_require__(1354), TIMELINE_START: __webpack_require__(1355),
TIMELINE_UPDATE: __webpack_require__(1355), TIMELINE_UPDATE: __webpack_require__(1356),
TWEEN_ACTIVE: __webpack_require__(1356), TWEEN_ACTIVE: __webpack_require__(1357),
TWEEN_COMPLETE: __webpack_require__(1357), TWEEN_COMPLETE: __webpack_require__(1358),
TWEEN_LOOP: __webpack_require__(1358), TWEEN_LOOP: __webpack_require__(1359),
TWEEN_REPEAT: __webpack_require__(1359), TWEEN_REPEAT: __webpack_require__(1360),
TWEEN_START: __webpack_require__(1360), TWEEN_START: __webpack_require__(1361),
TWEEN_UPDATE: __webpack_require__(1361), TWEEN_UPDATE: __webpack_require__(1362),
TWEEN_YOYO: __webpack_require__(1362) TWEEN_YOYO: __webpack_require__(1363)
}; };
@ -107222,7 +107209,7 @@ module.exports = Tilemap;
var Class = __webpack_require__(0); var Class = __webpack_require__(0);
var Components = __webpack_require__(11); var Components = __webpack_require__(11);
var DynamicTilemapLayerRender = __webpack_require__(1337); var DynamicTilemapLayerRender = __webpack_require__(1338);
var GameObject = __webpack_require__(13); var GameObject = __webpack_require__(13);
var TilemapComponents = __webpack_require__(136); var TilemapComponents = __webpack_require__(136);
var Vector2 = __webpack_require__(3); var Vector2 = __webpack_require__(3);
@ -108562,7 +108549,7 @@ var Class = __webpack_require__(0);
var Components = __webpack_require__(11); var Components = __webpack_require__(11);
var GameEvents = __webpack_require__(18); var GameEvents = __webpack_require__(18);
var GameObject = __webpack_require__(13); var GameObject = __webpack_require__(13);
var StaticTilemapLayerRender = __webpack_require__(1340); var StaticTilemapLayerRender = __webpack_require__(1341);
var TilemapComponents = __webpack_require__(136); var TilemapComponents = __webpack_require__(136);
var TransformMatrix = __webpack_require__(30); var TransformMatrix = __webpack_require__(30);
var Utils = __webpack_require__(9); var Utils = __webpack_require__(9);
@ -110365,7 +110352,7 @@ module.exports = TimerEvent;
* @license {@link https://opensource.org/licenses/MIT|MIT License} * @license {@link https://opensource.org/licenses/MIT|MIT License}
*/ */
var RESERVED = __webpack_require__(1349); var RESERVED = __webpack_require__(1350);
/** /**
* Internal function used by the Tween Builder to return an array of properties * Internal function used by the Tween Builder to return an array of properties
@ -175483,15 +175470,15 @@ module.exports = CONST;
module.exports = { module.exports = {
Components: __webpack_require__(136), Components: __webpack_require__(136),
Parsers: __webpack_require__(1334), Parsers: __webpack_require__(1335),
Formats: __webpack_require__(33), Formats: __webpack_require__(33),
ImageCollection: __webpack_require__(484), ImageCollection: __webpack_require__(484),
ParseToTilemap: __webpack_require__(224), ParseToTilemap: __webpack_require__(224),
Tile: __webpack_require__(73), Tile: __webpack_require__(73),
Tilemap: __webpack_require__(493), Tilemap: __webpack_require__(493),
TilemapCreator: __webpack_require__(1343), TilemapCreator: __webpack_require__(1344),
TilemapFactory: __webpack_require__(1344), TilemapFactory: __webpack_require__(1345),
Tileset: __webpack_require__(138), Tileset: __webpack_require__(138),
LayerData: __webpack_require__(101), LayerData: __webpack_require__(101),
@ -175665,6 +175652,7 @@ module.exports = CreateFromTiles;
var SnapFloor = __webpack_require__(92); var SnapFloor = __webpack_require__(92);
var SnapCeil = __webpack_require__(326); var SnapCeil = __webpack_require__(326);
var CheckIsoBounds = __webpack_require__(1310);
/** /**
* Returns the tiles in the given layer that are within the camera's viewport. This is used internally. * Returns the tiles in the given layer that are within the camera's viewport. This is used internally.
@ -175704,8 +175692,6 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
var drawTop = 0; var drawTop = 0;
var drawBottom = mapHeight; var drawBottom = mapHeight;
// we define the isometric culling function as a dummy early on for it to make sense in scope
var inIsoBounds = function () { return true; };
if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1)
{ {
if (layer.orientation === 'orthogonal' || layer.orientation === 'staggered' || layer.orientation === 'hexagonal') if (layer.orientation === 'orthogonal' || layer.orientation === 'staggered' || layer.orientation === 'hexagonal')
@ -175746,20 +175732,6 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
drawBottom = Math.min(mapHeight, boundsBottom); drawBottom = Math.min(mapHeight, boundsBottom);
} }
else if (layer.orientation === 'isometric')
{
inIsoBounds = function (x,y)
{
var cullDistances = tilemapLayer.isoCullDistances;
var pos = tilemapLayer.tileToWorldXY(x,y,undefined,camera);
// we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles.
return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (- cullDistances.x - 1 / 2)
&& pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullDistances.x - 1 / 2)
&& pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (- cullDistances.y - 1 / 2)
&& pos.y < camera.worldView.bottom + tilemapLayer.scaleY * layer.tileHeight * (cullDistances.y - 1 / 2);
};
}
} }
var x; var x;
var y; var y;
@ -175856,7 +175828,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
{ {
for (x = drawLeft; mapData[y] && x < drawRight; x++) for (x = drawLeft; mapData[y] && x < drawRight; x++)
{ {
if (inIsoBounds(x,y)) if (CheckIsoBounds(x,y,layer,camera))
{ {
tile = mapData[y][x]; tile = mapData[y][x];
@ -175879,7 +175851,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
{ {
for (x = drawRight; mapData[y] && x >= drawLeft; x--) for (x = drawRight; mapData[y] && x >= drawLeft; x--)
{ {
if (inIsoBounds(x,y)) if (CheckIsoBounds(x,y,layer,camera))
{ {
tile = mapData[y][x]; tile = mapData[y][x];
@ -175901,7 +175873,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
{ {
for (x = drawLeft; mapData[y] && x < drawRight; x++) for (x = drawLeft; mapData[y] && x < drawRight; x++)
{ {
if (inIsoBounds(x,y)) if (CheckIsoBounds(x,y,layer,camera))
{ {
tile = mapData[y][x]; tile = mapData[y][x];
@ -175923,7 +175895,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
{ {
for (x = drawRight; mapData[y] && x >= drawLeft; x--) for (x = drawRight; mapData[y] && x >= drawLeft; x--)
{ {
if (inIsoBounds(x,y)) if (CheckIsoBounds(x,y,layer,camera))
{ {
tile = mapData[y][x]; tile = mapData[y][x];
@ -175952,6 +175924,46 @@ module.exports = CullTiles;
/***/ }), /***/ }),
/* 1310 */ /* 1310 */
/***/ (function(module, exports) {
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the
* specified index. Tiles will be set to collide if the given index is a colliding index.
* Collision information in the region will be recalculated.
*
* @function Phaser.Tilemaps.Components.CheckIsoBounds
* @private
* @since 3.2.3
*
* @param {integer} tileX - The x coordinate, in tiles, not pixels.
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to check against.
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against.
*/
var CheckIsoBounds = function (tileX,tileY,layer,camera)
{
var tilemapLayer = layer.tilemapLayer;
var cullDistances = tilemapLayer.isoCullDistances;
var pos = tilemapLayer.tileToWorldXY(tileX,tileY,undefined,camera);
// we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles.
return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (- cullDistances.x - 1 / 2)
&& pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullDistances.x - 1 / 2)
&& pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (- cullDistances.y - 1 / 2)
&& pos.y < camera.worldView.bottom + tilemapLayer.scaleY * layer.tileHeight * (cullDistances.y - 1 / 2);
};
module.exports = CheckIsoBounds;
/***/ }),
/* 1311 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176005,7 +176017,7 @@ module.exports = Fill;
/***/ }), /***/ }),
/* 1311 */ /* 1312 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176053,7 +176065,7 @@ module.exports = FilterTiles;
/***/ }), /***/ }),
/* 1312 */ /* 1313 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -176141,7 +176153,7 @@ module.exports = FindByIndex;
/***/ }), /***/ }),
/* 1313 */ /* 1314 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176195,7 +176207,7 @@ module.exports = FindTile;
/***/ }), /***/ }),
/* 1314 */ /* 1315 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176245,7 +176257,7 @@ module.exports = ForEachTile;
/***/ }), /***/ }),
/* 1315 */ /* 1316 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176285,7 +176297,7 @@ module.exports = GetTileAtWorldXY;
/***/ }), /***/ }),
/* 1316 */ /* 1317 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176383,7 +176395,7 @@ module.exports = GetTilesWithinShape;
/***/ }), /***/ }),
/* 1317 */ /* 1318 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176435,7 +176447,7 @@ module.exports = GetTilesWithinWorldXY;
/***/ }), /***/ }),
/* 1318 */ /* 1319 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176474,7 +176486,7 @@ module.exports = HasTileAtWorldXY;
/***/ }), /***/ }),
/* 1319 */ /* 1320 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176517,7 +176529,7 @@ module.exports = PutTileAtWorldXY;
/***/ }), /***/ }),
/* 1320 */ /* 1321 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176582,7 +176594,7 @@ module.exports = PutTilesAt;
/***/ }), /***/ }),
/* 1321 */ /* 1322 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176640,7 +176652,7 @@ module.exports = Randomize;
/***/ }), /***/ }),
/* 1322 */ /* 1323 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176681,7 +176693,7 @@ module.exports = RemoveTileAtWorldXY;
/***/ }), /***/ }),
/* 1323 */ /* 1324 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176770,7 +176782,7 @@ module.exports = RenderDebug;
/***/ }), /***/ }),
/* 1324 */ /* 1325 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176839,7 +176851,7 @@ module.exports = SetCollision;
/***/ }), /***/ }),
/* 1325 */ /* 1326 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176914,7 +176926,7 @@ module.exports = SetCollisionBetween;
/***/ }), /***/ }),
/* 1326 */ /* 1327 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -176971,7 +176983,7 @@ module.exports = SetCollisionByExclusion;
/***/ }), /***/ }),
/* 1327 */ /* 1328 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177046,7 +177058,7 @@ module.exports = SetCollisionByProperty;
/***/ }), /***/ }),
/* 1328 */ /* 1329 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177106,7 +177118,7 @@ module.exports = SetCollisionFromCollisionGroup;
/***/ }), /***/ }),
/* 1329 */ /* 1330 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -177153,7 +177165,7 @@ module.exports = SetTileIndexCallback;
/***/ }), /***/ }),
/* 1330 */ /* 1331 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177196,7 +177208,7 @@ module.exports = SetTileLocationCallback;
/***/ }), /***/ }),
/* 1331 */ /* 1332 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177241,7 +177253,7 @@ module.exports = Shuffle;
/***/ }), /***/ }),
/* 1332 */ /* 1333 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177292,7 +177304,7 @@ module.exports = SwapByIndex;
/***/ }), /***/ }),
/* 1333 */ /* 1334 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177372,7 +177384,7 @@ module.exports = WeightedRandomize;
/***/ }), /***/ }),
/* 1334 */ /* 1335 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177391,14 +177403,14 @@ module.exports = {
Parse2DArray: __webpack_require__(220), Parse2DArray: __webpack_require__(220),
ParseCSV: __webpack_require__(478), ParseCSV: __webpack_require__(478),
Impact: __webpack_require__(1335), Impact: __webpack_require__(1336),
Tiled: __webpack_require__(1336) Tiled: __webpack_require__(1337)
}; };
/***/ }), /***/ }),
/* 1335 */ /* 1336 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177421,7 +177433,7 @@ module.exports = {
/***/ }), /***/ }),
/* 1336 */ /* 1337 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177451,7 +177463,7 @@ module.exports = {
/***/ }), /***/ }),
/* 1337 */ /* 1338 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177465,12 +177477,12 @@ var renderCanvas = __webpack_require__(1);
if (true) if (true)
{ {
renderWebGL = __webpack_require__(1338); renderWebGL = __webpack_require__(1339);
} }
if (true) if (true)
{ {
renderCanvas = __webpack_require__(1339); renderCanvas = __webpack_require__(1340);
} }
module.exports = { module.exports = {
@ -177482,7 +177494,7 @@ module.exports = {
/***/ }), /***/ }),
/* 1338 */ /* 1339 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177611,7 +177623,7 @@ module.exports = DynamicTilemapLayerWebGLRenderer;
/***/ }), /***/ }),
/* 1339 */ /* 1340 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -177712,7 +177724,7 @@ var DynamicTilemapLayerCanvasRenderer = function (renderer, src, interpolationPe
{ {
// we use the tileset width and height because in isometric and hexagonal maps the tileset's height is often different from the tilemap's. // we use the tileset width and height because in isometric and hexagonal maps the tileset's height is often different from the tilemap's.
width = tileset.tileWidth; width = tileset.tileWidth;
width = tileset.tileHeight; height = tileset.tileHeight;
} }
var halfWidth = width / 2; var halfWidth = width / 2;
@ -177754,7 +177766,7 @@ module.exports = DynamicTilemapLayerCanvasRenderer;
/***/ }), /***/ }),
/* 1340 */ /* 1341 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -177768,12 +177780,12 @@ var renderCanvas = __webpack_require__(1);
if (true) if (true)
{ {
renderWebGL = __webpack_require__(1341); renderWebGL = __webpack_require__(1342);
} }
if (true) if (true)
{ {
renderCanvas = __webpack_require__(1342); renderCanvas = __webpack_require__(1343);
} }
module.exports = { module.exports = {
@ -177785,7 +177797,7 @@ module.exports = {
/***/ }), /***/ }),
/* 1341 */ /* 1342 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -177857,7 +177869,7 @@ module.exports = StaticTilemapLayerWebGLRenderer;
/***/ }), /***/ }),
/* 1342 */ /* 1343 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -177991,7 +178003,7 @@ module.exports = StaticTilemapLayerCanvasRenderer;
/***/ }), /***/ }),
/* 1343 */ /* 1344 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -178035,7 +178047,7 @@ GameObjectCreator.register('tilemap', function (config)
/***/ }), /***/ }),
/* 1344 */ /* 1345 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -178101,7 +178113,7 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt
/***/ }), /***/ }),
/* 1345 */ /* 1346 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -178116,14 +178128,14 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt
module.exports = { module.exports = {
Clock: __webpack_require__(1346), Clock: __webpack_require__(1347),
TimerEvent: __webpack_require__(496) TimerEvent: __webpack_require__(496)
}; };
/***/ }), /***/ }),
/* 1346 */ /* 1347 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -178529,7 +178541,7 @@ module.exports = Clock;
/***/ }), /***/ }),
/* 1347 */ /* 1348 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -178547,10 +178559,10 @@ var Extend = __webpack_require__(17);
var Tweens = { var Tweens = {
Builders: __webpack_require__(1348), Builders: __webpack_require__(1349),
Events: __webpack_require__(229), Events: __webpack_require__(229),
TweenManager: __webpack_require__(1363), TweenManager: __webpack_require__(1364),
Tween: __webpack_require__(228), Tween: __webpack_require__(228),
TweenData: __webpack_require__(230), TweenData: __webpack_require__(230),
Timeline: __webpack_require__(502) Timeline: __webpack_require__(502)
@ -178564,7 +178576,7 @@ module.exports = Tweens;
/***/ }), /***/ }),
/* 1348 */ /* 1349 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -178595,7 +178607,7 @@ module.exports = {
/***/ }), /***/ }),
/* 1349 */ /* 1350 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178670,7 +178682,7 @@ module.exports = [
/***/ }), /***/ }),
/* 1350 */ /* 1351 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178706,7 +178718,7 @@ module.exports = 'complete';
/***/ }), /***/ }),
/* 1351 */ /* 1352 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178743,7 +178755,7 @@ module.exports = 'loop';
/***/ }), /***/ }),
/* 1352 */ /* 1353 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178780,7 +178792,7 @@ module.exports = 'pause';
/***/ }), /***/ }),
/* 1353 */ /* 1354 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178817,7 +178829,7 @@ module.exports = 'resume';
/***/ }), /***/ }),
/* 1354 */ /* 1355 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178853,7 +178865,7 @@ module.exports = 'start';
/***/ }), /***/ }),
/* 1355 */ /* 1356 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178890,7 +178902,7 @@ module.exports = 'update';
/***/ }), /***/ }),
/* 1356 */ /* 1357 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178930,7 +178942,7 @@ module.exports = 'active';
/***/ }), /***/ }),
/* 1357 */ /* 1358 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -178971,7 +178983,7 @@ module.exports = 'complete';
/***/ }), /***/ }),
/* 1358 */ /* 1359 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -179015,7 +179027,7 @@ module.exports = 'loop';
/***/ }), /***/ }),
/* 1359 */ /* 1360 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -179060,7 +179072,7 @@ module.exports = 'repeat';
/***/ }), /***/ }),
/* 1360 */ /* 1361 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -179100,7 +179112,7 @@ module.exports = 'start';
/***/ }), /***/ }),
/* 1361 */ /* 1362 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -179143,7 +179155,7 @@ module.exports = 'update';
/***/ }), /***/ }),
/* 1362 */ /* 1363 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -179189,7 +179201,7 @@ module.exports = 'yoyo';
/***/ }), /***/ }),
/* 1363 */ /* 1364 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -179961,7 +179973,7 @@ module.exports = TweenManager;
/***/ }), /***/ }),
/* 1364 */ /* 1365 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -179977,15 +179989,15 @@ module.exports = TweenManager;
module.exports = { module.exports = {
Array: __webpack_require__(179), Array: __webpack_require__(179),
Base64: __webpack_require__(1365), Base64: __webpack_require__(1366),
Objects: __webpack_require__(1367), Objects: __webpack_require__(1368),
String: __webpack_require__(1371) String: __webpack_require__(1372)
}; };
/***/ }), /***/ }),
/* 1365 */ /* 1366 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -180000,14 +180012,14 @@ module.exports = {
module.exports = { module.exports = {
ArrayBufferToBase64: __webpack_require__(1366), ArrayBufferToBase64: __webpack_require__(1367),
Base64ToArrayBuffer: __webpack_require__(383) Base64ToArrayBuffer: __webpack_require__(383)
}; };
/***/ }), /***/ }),
/* 1366 */ /* 1367 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -180065,7 +180077,7 @@ module.exports = ArrayBufferToBase64;
/***/ }), /***/ }),
/* 1367 */ /* 1368 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -180084,14 +180096,14 @@ module.exports = {
Extend: __webpack_require__(17), Extend: __webpack_require__(17),
GetAdvancedValue: __webpack_require__(14), GetAdvancedValue: __webpack_require__(14),
GetFastValue: __webpack_require__(2), GetFastValue: __webpack_require__(2),
GetMinMaxValue: __webpack_require__(1368), GetMinMaxValue: __webpack_require__(1369),
GetValue: __webpack_require__(6), GetValue: __webpack_require__(6),
HasAll: __webpack_require__(1369), HasAll: __webpack_require__(1370),
HasAny: __webpack_require__(402), HasAny: __webpack_require__(402),
HasValue: __webpack_require__(105), HasValue: __webpack_require__(105),
IsPlainObject: __webpack_require__(7), IsPlainObject: __webpack_require__(7),
Merge: __webpack_require__(121), Merge: __webpack_require__(121),
MergeRight: __webpack_require__(1370), MergeRight: __webpack_require__(1371),
Pick: __webpack_require__(485), Pick: __webpack_require__(485),
SetValue: __webpack_require__(422) SetValue: __webpack_require__(422)
@ -180099,7 +180111,7 @@ module.exports = {
/***/ }), /***/ }),
/* 1368 */ /* 1369 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -180138,7 +180150,7 @@ module.exports = GetMinMaxValue;
/***/ }), /***/ }),
/* 1369 */ /* 1370 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -180175,7 +180187,7 @@ module.exports = HasAll;
/***/ }), /***/ }),
/* 1370 */ /* 1371 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -180218,7 +180230,7 @@ module.exports = MergeRight;
/***/ }), /***/ }),
/* 1371 */ /* 1372 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -180233,9 +180245,9 @@ module.exports = MergeRight;
module.exports = { module.exports = {
Format: __webpack_require__(1372), Format: __webpack_require__(1373),
Pad: __webpack_require__(158), Pad: __webpack_require__(158),
Reverse: __webpack_require__(1373), Reverse: __webpack_require__(1374),
UppercaseFirst: __webpack_require__(177), UppercaseFirst: __webpack_require__(177),
UUID: __webpack_require__(192) UUID: __webpack_require__(192)
@ -180243,7 +180255,7 @@ module.exports = {
/***/ }), /***/ }),
/* 1372 */ /* 1373 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -180278,7 +180290,7 @@ module.exports = Format;
/***/ }), /***/ }),
/* 1373 */ /* 1374 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -180307,7 +180319,7 @@ module.exports = Reverse;
/***/ }), /***/ }),
/* 1374 */ /* 1375 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/** /**
@ -180343,7 +180355,6 @@ module.exports = {
/***/ }), /***/ }),
/* 1375 */,
/* 1376 */, /* 1376 */,
/* 1377 */, /* 1377 */,
/* 1378 */, /* 1378 */,
@ -180395,7 +180406,8 @@ module.exports = {
/* 1424 */, /* 1424 */,
/* 1425 */, /* 1425 */,
/* 1426 */, /* 1426 */,
/* 1427 */ /* 1427 */,
/* 1428 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/** /* WEBPACK VAR INJECTION */(function(global) {/**
@ -180450,9 +180462,9 @@ var Phaser = {
Structs: __webpack_require__(1303), Structs: __webpack_require__(1303),
Textures: __webpack_require__(1304), Textures: __webpack_require__(1304),
Tilemaps: __webpack_require__(1306), Tilemaps: __webpack_require__(1306),
Time: __webpack_require__(1345), Time: __webpack_require__(1346),
Tweens: __webpack_require__(1347), Tweens: __webpack_require__(1348),
Utils: __webpack_require__(1364) Utils: __webpack_require__(1365)
}; };
@ -180462,7 +180474,7 @@ Phaser = Extend(false, Phaser, CONST);
if (true) if (true)
{ {
Phaser.Sound = __webpack_require__(1374); Phaser.Sound = __webpack_require__(1375);
} }
// Export it // Export it

File diff suppressed because one or more lines are too long

564
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

@ -125,8 +125,50 @@ var CONST = {
* @type {integer} * @type {integer}
* @since 3.0.0 * @since 3.0.0
*/ */
RIGHT: 8 RIGHT: 8,
/**
* Orientation constant.
*
* @name Phaser.ORTHOGONAL
* @const
* @type {integer}
* @since 3.2.2
*/
ORTHOGONAL: 0,
/**
* Orientation constant.
*
* @name Phaser.ISOMETRIC
* @const
* @type {integer}
* @since 3.2.2
*/
ISOMETRIC: 1,
/**
* Orientation constant.
*
* @name Phaser.STAGGERED
* @const
* @type {integer}
* @since 3.2.2
*/
STAGGERED: 2,
/**
* Orientation constant.
*
* @name Phaser.HEXAGONAL
* @const
* @type {integer}
* @since 3.2.2
*/
HEXAGONAL: 3
}; };
module.exports = CONST; module.exports = CONST;

View file

@ -0,0 +1,34 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the
* specified index. Tiles will be set to collide if the given index is a colliding index.
* Collision information in the region will be recalculated.
*
* @function Phaser.Tilemaps.Components.CheckIsoBounds
* @private
* @since 3.2.3
*
* @param {integer} tileX - The x coordinate, in tiles, not pixels.
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to check against.
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against.
*/
var CheckIsoBounds = function (tileX,tileY,layer,camera)
{
var tilemapLayer = layer.tilemapLayer;
var cullDistances = tilemapLayer.isoCullDistances;
var pos = tilemapLayer.tileToWorldXY(tileX,tileY,undefined,camera);
// we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles.
return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (- cullDistances.x - 1 / 2)
&& pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullDistances.x - 1 / 2)
&& pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (- cullDistances.y - 1 / 2)
&& pos.y < camera.worldView.bottom + tilemapLayer.scaleY * layer.tileHeight * (cullDistances.y - 1 / 2);
};
module.exports = CheckIsoBounds;

View file

@ -6,6 +6,7 @@
var SnapFloor = require('../../math/snap/SnapFloor'); var SnapFloor = require('../../math/snap/SnapFloor');
var SnapCeil = require('../../math/snap/SnapCeil'); var SnapCeil = require('../../math/snap/SnapCeil');
var CheckIsoBounds = require('./CheckIsoBounds');
/** /**
* Returns the tiles in the given layer that are within the camera's viewport. This is used internally. * Returns the tiles in the given layer that are within the camera's viewport. This is used internally.
@ -45,8 +46,6 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
var drawTop = 0; var drawTop = 0;
var drawBottom = mapHeight; var drawBottom = mapHeight;
// we define the isometric culling function as a dummy early on for it to make sense in scope
var inIsoBounds = function () { return true; };
if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1)
{ {
if (layer.orientation === 'orthogonal' || layer.orientation === 'staggered' || layer.orientation === 'hexagonal') if (layer.orientation === 'orthogonal' || layer.orientation === 'staggered' || layer.orientation === 'hexagonal')
@ -87,20 +86,6 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
drawBottom = Math.min(mapHeight, boundsBottom); drawBottom = Math.min(mapHeight, boundsBottom);
} }
else if (layer.orientation === 'isometric')
{
inIsoBounds = function (x,y)
{
var cullDistances = tilemapLayer.isoCullDistances;
var pos = tilemapLayer.tileToWorldXY(x,y,undefined,camera);
// we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles.
return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (- cullDistances.x - 1 / 2)
&& pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullDistances.x - 1 / 2)
&& pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (- cullDistances.y - 1 / 2)
&& pos.y < camera.worldView.bottom + tilemapLayer.scaleY * layer.tileHeight * (cullDistances.y - 1 / 2);
};
}
} }
var x; var x;
var y; var y;
@ -197,7 +182,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
{ {
for (x = drawLeft; mapData[y] && x < drawRight; x++) for (x = drawLeft; mapData[y] && x < drawRight; x++)
{ {
if (inIsoBounds(x,y)) if (CheckIsoBounds(x,y,layer,camera))
{ {
tile = mapData[y][x]; tile = mapData[y][x];
@ -220,7 +205,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
{ {
for (x = drawRight; mapData[y] && x >= drawLeft; x--) for (x = drawRight; mapData[y] && x >= drawLeft; x--)
{ {
if (inIsoBounds(x,y)) if (CheckIsoBounds(x,y,layer,camera))
{ {
tile = mapData[y][x]; tile = mapData[y][x];
@ -242,7 +227,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
{ {
for (x = drawLeft; mapData[y] && x < drawRight; x++) for (x = drawLeft; mapData[y] && x < drawRight; x++)
{ {
if (inIsoBounds(x,y)) if (CheckIsoBounds(x,y,layer,camera))
{ {
tile = mapData[y][x]; tile = mapData[y][x];
@ -264,7 +249,7 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
{ {
for (x = drawRight; mapData[y] && x >= drawLeft; x--) for (x = drawRight; mapData[y] && x >= drawLeft; x--)
{ {
if (inIsoBounds(x,y)) if (CheckIsoBounds(x,y,layer,camera))
{ {
tile = mapData[y][x]; tile = mapData[y][x];

View file

@ -112,7 +112,6 @@ var DynamicTilemapLayer = new Class({
// Link the LayerData with this static tilemap layer // Link the LayerData with this static tilemap layer
this.layer.tilemapLayer = this; this.layer.tilemapLayer = this;
console.log('fug',this.layer);
/** /**
* The Tileset/s associated with this layer. * The Tileset/s associated with this layer.