mirror of
https://github.com/wassname/phaser.git
synced 2026-07-29 11:24:31 +08:00
Started revamp of the Tilemap system. Also removed old 'Advanced Physics' and dropped in p2.js which is what I hope we'll eventually use.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
|
||||
Phaser.Tileset = function (key, tileWidth, tileHeight) {
|
||||
|
||||
/**
|
||||
* @property {string} key - The cache ID.
|
||||
*/
|
||||
this.key = key;
|
||||
|
||||
this.tilewidth = tileWidth;
|
||||
this.tileHeight = tileHeight;
|
||||
|
||||
this._tiles = [];
|
||||
|
||||
}
|
||||
|
||||
Phaser.Tileset.prototype = {
|
||||
|
||||
addTile: function (tile) {
|
||||
|
||||
this._tiles.push(tile);
|
||||
|
||||
return tile;
|
||||
|
||||
},
|
||||
|
||||
getTile: function (index) {
|
||||
|
||||
if (this._tiles[index])
|
||||
{
|
||||
return this._tiles[index];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Phaser.Tileset#total
|
||||
* @property {number} total - The total number of tiles in this Tileset.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Tileset.prototype, "total", {
|
||||
|
||||
get: function () {
|
||||
return this._ties.length;
|
||||
}
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user