Skip to content

Commit 00603c0

Browse files
committed
Tilemaps.Components.GetTileToWorldXFunction is a new function that returns the correct conversion function to use.
1 parent 3eaacff commit 00603c0

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2020 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
var CONST = require('../const');
8+
var NOOP = require('../../utils/NOOP');
9+
var TileToWorldX = require('./TileToWorldX');
10+
11+
/**
12+
* Gets the correct function to use to translate tiles, based on the map orientation.
13+
*
14+
* @function Phaser.Tilemaps.Components.GetTileToWorldXFunction
15+
* @since 3.50.0
16+
*
17+
* @param {number} orientation - The Tilemap orientation constant.
18+
*
19+
* @return {Phaser.Tilemaps.Components.TileToWorldX)} The function to use to translate tiles for the given map type.
20+
*/
21+
var GetTileToWorldXFunction = function (orientation)
22+
{
23+
if (orientation === CONST.ORTHOGONAL)
24+
{
25+
return TileToWorldX;
26+
}
27+
else
28+
{
29+
return NOOP;
30+
}
31+
};
32+
33+
module.exports = GetTileToWorldXFunction;

0 commit comments

Comments
 (0)