mirror of
https://github.com/wassname/phaser.git
synced 2026-08-15 12:45:11 +08:00
Updated doc files.
This commit is contained in:
+155
-76
@@ -90,6 +90,10 @@
|
||||
<a href="Phaser.Device.html">Device</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.DOMSprite.html">DOMSprite</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Easing.html">Easing</a>
|
||||
</li>
|
||||
@@ -162,6 +166,14 @@
|
||||
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Graphics.html">Graphics</a>
|
||||
</li>
|
||||
@@ -186,6 +198,10 @@
|
||||
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Line.html">Line</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||
</li>
|
||||
@@ -278,6 +294,10 @@
|
||||
<a href="Phaser.Signal.html">Signal</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Sound.html">Sound</a>
|
||||
</li>
|
||||
@@ -342,6 +362,10 @@
|
||||
<a href="Phaser.Timer.html">Timer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Touch.html">Touch</a>
|
||||
</li>
|
||||
@@ -374,36 +398,6 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||
class="caret"></b></a>
|
||||
|
||||
<ul class="dropdown-menu ">
|
||||
|
||||
<li>
|
||||
<a href="global.html#bottom">bottom</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#HEXtoRGB">HEXtoRGB</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#render">render</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#renderXY">renderXY</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#right">right</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -423,35 +417,45 @@
|
||||
<article>
|
||||
<pre class="sunlight-highlight-javascript linenums">/**
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @copyright 2014 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a new `Tile` object. Tiles live inside of Tilesets and are rendered via TilemapLayers.
|
||||
* Create a new `Tile` object.
|
||||
*
|
||||
* @class Phaser.Tile
|
||||
* @classdesc A Tile is a single representation of a tile within a Tilemap.
|
||||
* @classdesc A Tile is a representation of a single tile within the Tilemap.
|
||||
* @constructor
|
||||
* @param {Phaser.Tileset} tileset - The tileset this tile belongs to.
|
||||
* @param {object} layer - The layer in the Tilemap data that this tile belongs to.
|
||||
* @param {number} index - The index of this tile type in the core map data.
|
||||
* @param {number} x - The x coordinate of this tile.
|
||||
* @param {number} y - The y coordinate of this tile.
|
||||
* @param {number} width - Width of the tile.
|
||||
* @param {number} height - Height of the tile.
|
||||
*/
|
||||
Phaser.Tile = function (tileset, index, x, y, width, height) {
|
||||
Phaser.Tile = function (layer, index, x, y, width, height) {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Tileset} tileset - The tileset this tile belongs to.
|
||||
* @property {object} layer - The layer in the Tilemap data that this tile belongs to.
|
||||
*/
|
||||
this.tileset = tileset;
|
||||
|
||||
this.layer = layer;
|
||||
|
||||
/**
|
||||
* @property {number} index - The index of this tile within the tileset.
|
||||
* @property {number} index - The index of this tile within the map data corresponding to the tileset.
|
||||
*/
|
||||
this.index = index;
|
||||
|
||||
/**
|
||||
* @property {number} x - The x map coordinate of this tile.
|
||||
*/
|
||||
this.x = x;
|
||||
|
||||
/**
|
||||
* @property {number} y - The y map coordinate of this tile.
|
||||
*/
|
||||
this.y = y;
|
||||
|
||||
/**
|
||||
* @property {number} width - The width of the tile in pixels.
|
||||
*/
|
||||
@@ -463,22 +467,44 @@ Phaser.Tile = function (tileset, index, x, y, width, height) {
|
||||
this.height = height;
|
||||
|
||||
/**
|
||||
* @property {number} x - The top-left corner of the tile within the tileset.
|
||||
* @property {number} alpha - The alpha value at which this tile is drawn to the canvas.
|
||||
*/
|
||||
this.x = x;
|
||||
|
||||
/**
|
||||
* @property {number} y - The top-left corner of the tile within the tileset.
|
||||
*/
|
||||
this.y = y;
|
||||
|
||||
// Any extra meta data info we need here
|
||||
this.alpha = 1;
|
||||
|
||||
/**
|
||||
* @property {number} mass - The virtual mass of the tile.
|
||||
* @default
|
||||
* @property {object} properties - Tile specific properties.
|
||||
*/
|
||||
this.mass = 1.0;
|
||||
this.properties = {};
|
||||
|
||||
/**
|
||||
* @property {boolean} scanned - Has this tile been walked / turned into a poly?
|
||||
*/
|
||||
this.scanned = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} faceTop - Is the top of this tile an interesting edge?
|
||||
*/
|
||||
this.faceTop = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} faceBottom - Is the bottom of this tile an interesting edge?
|
||||
*/
|
||||
this.faceBottom = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} faceLeft - Is the left of this tile an interesting edge?
|
||||
*/
|
||||
this.faceLeft = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} faceRight - Is the right of this tile an interesting edge?
|
||||
*/
|
||||
this.faceRight = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} collides - Does this tile collide at all?
|
||||
*/
|
||||
this.collides = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} collideNone - Indicating this Tile doesn't collide at all.
|
||||
@@ -511,38 +537,27 @@ Phaser.Tile = function (tileset, index, x, y, width, height) {
|
||||
this.collideDown = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} separateX - Enable separation at x-axis.
|
||||
* @property {function} callback - Tile collision callback.
|
||||
* @default
|
||||
*/
|
||||
this.separateX = true;
|
||||
this.callback = null;
|
||||
|
||||
/**
|
||||
* @property {boolean} separateY - Enable separation at y-axis.
|
||||
* @property {object} callbackContext - The context in which the collision callback will be called.
|
||||
* @default
|
||||
*/
|
||||
this.separateY = true;
|
||||
|
||||
/**
|
||||
* @property {boolean} collisionCallback - Tilemap collision callback.
|
||||
* @default
|
||||
*/
|
||||
this.collisionCallback = null;
|
||||
|
||||
/**
|
||||
* @property {boolean} collisionCallback - Tilemap collision callback.
|
||||
* @default
|
||||
*/
|
||||
this.collisionCallbackContext = this;
|
||||
this.callbackContext = this;
|
||||
|
||||
};
|
||||
|
||||
Phaser.Tile.prototype = {
|
||||
|
||||
/**
|
||||
* Set callback to be called when this tilemap collides.
|
||||
* Set a callback to be called when this tile is hit by an object.
|
||||
* The callback must true true for collision processing to take place.
|
||||
*
|
||||
* @method Phaser.Tile#setCollisionCallback
|
||||
* @param {Function} callback - Callback function.
|
||||
* @param {function} callback - Callback function.
|
||||
* @param {object} context - Callback will be called with this context.
|
||||
*/
|
||||
setCollisionCallback: function (callback, context) {
|
||||
@@ -558,7 +573,9 @@ Phaser.Tile.prototype = {
|
||||
*/
|
||||
destroy: function () {
|
||||
|
||||
this.tileset = null;
|
||||
this.collisionCallback = null;
|
||||
this.collisionCallbackContext = null;
|
||||
this.properties = null;
|
||||
|
||||
},
|
||||
|
||||
@@ -600,19 +617,55 @@ Phaser.Tile.prototype = {
|
||||
this.collideUp = false;
|
||||
this.collideDown = false;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Copies the tile data and properties from the given tile to this tile.
|
||||
* @method Phaser.Tile#copy
|
||||
* @param {Phaser.Tile} tile - The tile to copy from.
|
||||
*/
|
||||
copy: function (tile) {
|
||||
|
||||
this.index = tile.index;
|
||||
this.alpha = tile.alpha;
|
||||
this.properties = tile.properties;
|
||||
this.collides = tile.collides;
|
||||
this.collideNone = tile.collideNone;
|
||||
this.collideUp = tile.collideUp;
|
||||
this.collideDown = tile.collideDown;
|
||||
this.collideLeft = tile.collideLeft;
|
||||
this.collideRight = tile.collideRight;
|
||||
this.collisionCallback = tile.collisionCallback;
|
||||
this.collisionCallbackContext = tile.collisionCallbackContext;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Phaser.Tile.prototype.constructor = Phaser.Tile;
|
||||
|
||||
/**
|
||||
* @name Phaser.Tile#bottom
|
||||
* @property {number} bottom - The sum of the y and height properties.
|
||||
* @name Phaser.Tile#canCollide
|
||||
* @property {boolean} canCollide - True if this tile can collide or has a collision callback.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Tile.prototype, "bottom", {
|
||||
Object.defineProperty(Phaser.Tile.prototype, "canCollide", {
|
||||
|
||||
get: function () {
|
||||
return this.y + this.height;
|
||||
return (this.collides || this.collisionCallback || this.layer.callbacks[this.index]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* @name Phaser.Tile#left
|
||||
* @property {number} left - The x value.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Tile.prototype, "left", {
|
||||
|
||||
get: function () {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -628,6 +681,32 @@ Object.defineProperty(Phaser.Tile.prototype, "right", {
|
||||
return this.x + this.width;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* @name Phaser.Tile#top
|
||||
* @property {number} top - The y value.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Tile.prototype, "top", {
|
||||
|
||||
get: function () {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* @name Phaser.Tile#bottom
|
||||
* @property {number} bottom - The sum of the y and height properties.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Tile.prototype, "bottom", {
|
||||
|
||||
get: function () {
|
||||
return this.y + this.height;
|
||||
}
|
||||
|
||||
});
|
||||
</pre>
|
||||
</article>
|
||||
@@ -644,13 +723,13 @@ Object.defineProperty(Phaser.Tile.prototype, "right", {
|
||||
|
||||
|
||||
<span class="copyright">
|
||||
Phaser Copyright © 2012-2013 Photon Storm Ltd.
|
||||
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||
</span>
|
||||
<br />
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user