Make naming consistent for accessing individual tiles (e.g. getTile vs getTileAt)

This commit is contained in:
Michael Hadley 2017-11-18 15:41:26 -06:00
parent 759252a078
commit 3f14382951
8 changed files with 40 additions and 40 deletions

View file

@ -334,20 +334,20 @@ var Tilemap = new Class({
}
},
putTile: function (tile, tileX, tileY, layer)
putTileAt: function (tile, tileX, tileY, layer)
{
layer = this.getLayer(layer);
if (this._isStaticCall(layer, 'putTile')) { return null; }
if (this._isStaticCall(layer, 'putTileAt')) { return null; }
if (layer === null) { return null; }
return TilemapComponents.PutTile(tile, tileX, tileY, layer);
return TilemapComponents.PutTileAt(tile, tileX, tileY, layer);
},
putTileWorldXY: function (tile, worldX, worldY, camera, layer)
putTileAtWorldXY: function (tile, worldX, worldY, camera, layer)
{
layer = this.getLayer(layer);
if (this._isStaticCall(layer, 'putTileWorldXY')) { return null; }
if (this._isStaticCall(layer, 'putTileAtWorldXY')) { return null; }
if (layer === null) { return null; }
return TilemapComponents.PutTileWorldXY(tile, worldX, worldY, camera, layer);
return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, camera, layer);
},
randomize: function (tileX, tileY, width, height, indices, layer)
@ -368,20 +368,20 @@ var Tilemap = new Class({
return this;
},
removeTile: function (tileX, tileY, replaceWithNull, layer)
removeTileAt: function (tileX, tileY, replaceWithNull, layer)
{
layer = this.getLayer(layer);
if (this._isStaticCall(layer, 'removeTile')) { return null; }
if (this._isStaticCall(layer, 'removeTileAt')) { return null; }
if (layer === null) { return null; }
return TilemapComponents.RemoveTile(tileX, tileY, replaceWithNull, layer);
return TilemapComponents.RemoveTileAt(tileX, tileY, replaceWithNull, layer);
},
removeTileWorldXY: function (worldX, worldY, replaceWithNull, camera, layer)
removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, camera, layer)
{
layer = this.getLayer(layer);
if (this._isStaticCall(layer, 'removeTileWorldXY')) { return null; }
if (this._isStaticCall(layer, 'removeTileAtWorldXY')) { return null; }
if (layer === null) { return null; }
return TilemapComponents.RemoveTileWorldXY(worldX, worldY, replaceWithNull, camera, layer);
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, camera, layer);
},
replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height, layer)

View file

@ -1,12 +1,12 @@
var PutTile = require('./PutTile');
var PutTileAt = require('./PutTileAt');
var WorldToTileX = require('./WorldToTileX');
var WorldToTileY = require('./WorldToTileY');
var PutTileWorldXY = function (tile, worldX, worldY, camera, layer)
var PutTileAtWorldXY = function (tile, worldX, worldY, camera, layer)
{
var tileX = WorldToTileX(worldX, camera, layer);
var tileY = WorldToTileY(worldY, camera, layer);
return PutTile(tile, tileX, tileY, layer);
return PutTileAt(tile, tileX, tileY, layer);
};
module.exports = PutTileWorldXY;
module.exports = PutTileAtWorldXY;

View file

@ -0,0 +1,12 @@
var RemoveTileAt = require('./RemoveTileAt');
var WorldToTileX = require('./WorldToTileX');
var WorldToTileY = require('./WorldToTileY');
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, camera, layer)
{
var tileX = WorldToTileX(worldX, camera, layer);
var tileY = WorldToTileY(worldY, camera, layer);
return RemoveTileAt(tileX, tileY, replaceWithNull, layer);
};
module.exports = RemoveTileAtWorldXY;

View file

@ -1,12 +0,0 @@
var RemoveTile = require('./RemoveTile');
var WorldToTileX = require('./WorldToTileX');
var WorldToTileY = require('./WorldToTileY');
var RemoveTileWorldXY = function (worldX, worldY, replaceWithNull, camera, layer)
{
var tileX = WorldToTileX(worldX, camera, layer);
var tileY = WorldToTileY(worldY, camera, layer);
return RemoveTile(tileX, tileY, replaceWithNull, layer);
};
module.exports = RemoveTileWorldXY;

View file

@ -11,11 +11,11 @@ module.exports = {
HasTileAt: require('./HasTileAt'),
HasTileAtWorldXY: require('./HasTileAtWorldXY'),
IsInLayerBounds: require('./IsInLayerBounds'),
PutTile: require('./PutTile'),
PutTileWorldXY: require('./PutTileWorldXY'),
PutTileAt: require('./PutTileAt'),
PutTileAtWorldXY: require('./PutTileAtWorldXY'),
Randomize: require('./Randomize'),
RemoveTile: require('./RemoveTile'),
RemoveTileWorldXY: require('./RemoveTileWorldXY'),
RemoveTileAt: require('./RemoveTileAt'),
RemoveTileAtWorldXY: require('./RemoveTileAtWorldXY'),
ReplaceByIndex: require('./ReplaceByIndex'),
Shuffle: require('./Shuffle'),
SwapByIndex: require('./SwapByIndex'),

View file

@ -112,14 +112,14 @@ var DynamicTilemapLayer = new Class({
return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, this.layer);
},
putTile: function (tile, tileX, tileY)
putTileAt: function (tile, tileX, tileY)
{
return TilemapComponents.PutTile(tile, tileX, tileY, this.layer);
return TilemapComponents.PutTileAt(tile, tileX, tileY, this.layer);
},
putTileWorldXY: function (tile, worldX, worldY, camera)
putTileAtWorldXY: function (tile, worldX, worldY, camera)
{
return TilemapComponents.PutTileWorldXY(tile, worldX, worldY, camera, this.layer);
return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, camera, this.layer);
},
randomize: function (tileX, tileY, width, height, indices)
@ -128,14 +128,14 @@ var DynamicTilemapLayer = new Class({
return this;
},
removeTile: function (tileX, tileY, replaceWithNull)
removeTileAt: function (tileX, tileY, replaceWithNull)
{
return TilemapComponents.RemoveTile(tileX, tileY, replaceWithNull, this.layer);
return TilemapComponents.RemoveTileAt(tileX, tileY, replaceWithNull, this.layer);
},
removeTileWorldXY: function (worldX, worldY, replaceWithNull, camera)
removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, camera)
{
return TilemapComponents.RemoveTileWorldXY(worldX, worldY, replaceWithNull, camera, this.layer);
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, camera, this.layer);
},
replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height)