mirror of
https://github.com/wassname/phaser.git
synced 2026-08-07 11:26:10 +08:00
Adding docs.
This commit is contained in:
+61
-31
@@ -1,91 +1,120 @@
|
||||
/**
|
||||
* Phaser - Tile
|
||||
*
|
||||
* A Tile is a single representation of a tile within a Tilemap
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.Tile
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Tile constructor
|
||||
* Create a new <code>Tile</code>.
|
||||
*
|
||||
* @param tilemap {Tilemap} the tilemap this tile belongs to.
|
||||
* @param index {number} The index of this tile type in the core map data.
|
||||
* @param width {number} Width of the tile.
|
||||
* @param height number} Height of the tile.
|
||||
* @class Phaser.Tile
|
||||
* @classdesc A Tile is a single representation of a tile within a Tilemap.
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
* @param {Tilemap} tilemap - The tilemap this tile belongs to.
|
||||
* @param {number} index - The index of this tile type in the core map data.
|
||||
* @param {number} width - Width of the tile.
|
||||
* @param {number} height - Height of the tile.
|
||||
*/
|
||||
Phaser.Tile = function (game, tilemap, index, width, height) {
|
||||
|
||||
/**
|
||||
* The virtual mass of the tile.
|
||||
* @type {number}
|
||||
* @property {number} mass - The virtual mass of the tile.
|
||||
* @default
|
||||
*/
|
||||
this.mass = 1.0;
|
||||
|
||||
/**
|
||||
* Indicating this Tile doesn't collide at all.
|
||||
* @type {bool}
|
||||
* @property {bool} collideNone - Indicating this Tile doesn't collide at all.
|
||||
* @default
|
||||
*/
|
||||
this.collideNone = true;
|
||||
|
||||
/**
|
||||
* Indicating collide with any object on the left.
|
||||
* @type {bool}
|
||||
* @property {bool} collideLeft - Indicating collide with any object on the left.
|
||||
* @default
|
||||
*/
|
||||
this.collideLeft = false;
|
||||
|
||||
/**
|
||||
* Indicating collide with any object on the right.
|
||||
* @type {bool}
|
||||
* @property {bool} collideRight - Indicating collide with any object on the right.
|
||||
* @default
|
||||
*/
|
||||
this.collideRight = false;
|
||||
|
||||
/**
|
||||
* Indicating collide with any object on the top.
|
||||
* @type {bool}
|
||||
* @property {bool} collideUp - Indicating collide with any object on the top.
|
||||
* @default
|
||||
*/
|
||||
this.collideUp = false;
|
||||
|
||||
/**
|
||||
* Indicating collide with any object on the bottom.
|
||||
* @type {bool}
|
||||
* @property {bool} collideDown - Indicating collide with any object on the bottom.
|
||||
* @default
|
||||
*/
|
||||
this.collideDown = false;
|
||||
|
||||
/**
|
||||
* Enable separation at x-axis.
|
||||
* @type {bool}
|
||||
* @property {bool} separateX - Enable separation at x-axis.
|
||||
* @default
|
||||
*/
|
||||
this.separateX = true;
|
||||
|
||||
/**
|
||||
* Enable separation at y-axis.
|
||||
* @type {bool}
|
||||
* @property {bool} separateY - Enable separation at y-axis.
|
||||
* @default
|
||||
*/
|
||||
this.separateY = true;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - A reference to the currently running game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {bool} tilemap - The tilemap this tile belongs to.
|
||||
*/
|
||||
this.tilemap = tilemap;
|
||||
|
||||
/**
|
||||
* @property {number} index - The index of this tile type in the core map data.
|
||||
*/
|
||||
this.index = index;
|
||||
|
||||
/**
|
||||
* @property {number} width - The width of the tile.
|
||||
*/
|
||||
this.width = width;
|
||||
|
||||
/**
|
||||
* @property {number} height - The height of the tile.
|
||||
*/
|
||||
this.height = height;
|
||||
|
||||
};
|
||||
|
||||
Phaser.Tile.prototype = {
|
||||
|
||||
/**
|
||||
/**
|
||||
* Clean up memory.
|
||||
* @method destroy
|
||||
*/
|
||||
destroy: function () {
|
||||
this.tilemap = null;
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set collision configs.
|
||||
* @param collision {number} Bit field of flags. (see Tile.allowCollision)
|
||||
* @param resetCollisions {bool} Reset collision flags before set.
|
||||
* @param separateX {bool} Enable seprate at x-axis.
|
||||
* @param separateY {bool} Enable seprate at y-axis.
|
||||
* @method setCollision
|
||||
* @param {bool} left - Indicating collide with any object on the left.
|
||||
* @param {bool} right - Indicating collide with any object on the right.
|
||||
* @param {bool} up - Indicating collide with any object on the top.
|
||||
* @param {bool} down - Indicating collide with any object on the bottom.
|
||||
* @param {bool} reset - Description.
|
||||
* @param {bool} separateX - Separate at x-axis.
|
||||
* @param {bool} separateY - Separate at y-axis.
|
||||
*/
|
||||
setCollision: function (left, right, up, down, reset, separateX, separateY) {
|
||||
|
||||
@@ -110,8 +139,9 @@ Phaser.Tile.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Reset collision status flags.
|
||||
* @method resetCollision
|
||||
*/
|
||||
resetCollision: function () {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user