mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Explicitly paused Timer continues if you un-focus and focus the browser window (thanks georgiee)
Added TimerEvent.pendingDelete and checks in Timer.update, so that removing an event in a callback no longer throws an exception (thanks georgiee) Fixed TypeScript defs on lines 1741-1748 (thanks wombatbuddy) Added SAT.js to TypeScript definition. Now compiles properly. Added missing Line.js to the Grunt file. Tilemap#paste diffX and diffY equations changed, fixed issue #393 (thanks brejep) Added missing return value in Body.hitLeft and hitRight, fixes issue #398 (thanks ram64). Fixed easing tween example case. Issue #379 (thanks wesleywerner) Removed SAT.js UMD wrapped, fixes issue #361 (thanks luizbills) Removed inContact check from Body.separate. Fixed Tilemap docs (wrongly pointed to Tileset methods)
This commit is contained in:
+64
-26
@@ -463,14 +463,49 @@ Phaser.Tilemap = function (game, key) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @property {number} width - The width of the map (in tiles).
|
||||
*/
|
||||
this.width = data.width;
|
||||
|
||||
/**
|
||||
* @property {number} height - The height of the map (in tiles).
|
||||
*/
|
||||
this.height = data.height;
|
||||
|
||||
/**
|
||||
* @property {number} tileWidth - The base width of the tiles in the map (in pixels).
|
||||
*/
|
||||
this.tileWidth = data.tileWidth;
|
||||
|
||||
/**
|
||||
* @property {number} tileHeight - The base height of the tiles in the map (in pixels).
|
||||
*/
|
||||
this.tileHeight = data.tileHeight;
|
||||
|
||||
/**
|
||||
* @property {string} orientation - The orientation of the map data (as specified in Tiled), usually 'orthogonal'.
|
||||
*/
|
||||
this.orientation = data.orientation;
|
||||
|
||||
/**
|
||||
* @property {number} version - The version of the map data (as specified in Tiled, usually 1).
|
||||
*/
|
||||
this.version = data.version;
|
||||
|
||||
/**
|
||||
* @property {object} properties - Map specific properties as specified in Tiled.
|
||||
*/
|
||||
this.properties = data.properties;
|
||||
|
||||
/**
|
||||
* @property {number} widthInPixels - The width of the map in pixels based on width * tileWidth.
|
||||
*/
|
||||
this.widthInPixels = data.widthInPixels;
|
||||
|
||||
/**
|
||||
* @property {number} heightInPixels - The height of the map in pixels based on height * tileHeight.
|
||||
*/
|
||||
this.heightInPixels = data.heightInPixels;
|
||||
|
||||
/**
|
||||
@@ -515,13 +550,13 @@ Phaser.Tilemap = function (game, key) {
|
||||
this._results = [];
|
||||
|
||||
/**
|
||||
* @property {number} _tempA - Internal var.
|
||||
* @property {number} _tempA - Internal cache var.
|
||||
* @private
|
||||
*/
|
||||
this._tempA = 0;
|
||||
|
||||
/**
|
||||
* @property {number} _tempB - Internal var.
|
||||
* @property {number} _tempB - Internal cache var.
|
||||
* @private
|
||||
*/
|
||||
this._tempB = 0;
|
||||
@@ -576,7 +611,7 @@ Phaser.Tilemap.prototype = {
|
||||
format: Phaser.Tilemap.CSV,
|
||||
data: data,
|
||||
indexes: [],
|
||||
dirty: true
|
||||
dirty: true
|
||||
|
||||
});
|
||||
|
||||
@@ -622,12 +657,13 @@ Phaser.Tilemap.prototype = {
|
||||
|
||||
},
|
||||
|
||||
// Region? Remove tile from map data?
|
||||
/*
|
||||
createFromTiles: function (layer, tileIndex, key, frame, group) {
|
||||
|
||||
if (typeof group === 'undefined') { group = this.game.world; }
|
||||
|
||||
},
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a Sprite for every object matching the given gid in the map data. You can optionally specify the group that the Sprite will be created in. If none is
|
||||
@@ -635,7 +671,7 @@ Phaser.Tilemap.prototype = {
|
||||
* configure Sprite properties from within the map editor. For example giving an object a property if alpha: 0.5 in the map editor will duplicate that when the
|
||||
* Sprite is created. You could also give it a value like: body.velocity.x: 100 to set it moving automatically.
|
||||
*
|
||||
* @method Phaser.Tileset#createFromObjects
|
||||
* @method Phaser.Tilemap#createFromObjects
|
||||
* @param {string} name - The name of the Object Group to create Sprites from.
|
||||
* @param {number} gid - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.
|
||||
* @param {string} key - The Game.cache key of the image that this Sprite will use.
|
||||
@@ -680,8 +716,10 @@ Phaser.Tilemap.prototype = {
|
||||
|
||||
/**
|
||||
* Creates a new TilemapLayer object. By default TilemapLayers are fixed to the camera.
|
||||
* The `layer` parameter is important. If you've created your map in Tiled then you can get this by looking in Tiled and looking at the Layer name.
|
||||
* Or you can open the JSON file it exports and look at the layers[].name value. Either way it must match.
|
||||
*
|
||||
* @method Phaser.Tileset#createLayer
|
||||
* @method Phaser.Tilemap#createLayer
|
||||
* @param {number|string} layer - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.
|
||||
* @param {number} [width] - The rendered width of the layer, should never be wider than Game.width. If not given it will be set to Game.width.
|
||||
* @param {number} [height] - The rendered height of the layer, should never be wider than Game.height. If not given it will be set to Game.height.
|
||||
@@ -716,7 +754,7 @@ Phaser.Tilemap.prototype = {
|
||||
/**
|
||||
* Gets the layer index based on the layers name.
|
||||
*
|
||||
* @method Phaser.Tileset#getIndex
|
||||
* @method Phaser.Tilemap#getIndex
|
||||
* @protected
|
||||
* @param {array} location - The local array to search.
|
||||
* @param {string} name - The name of the array element to get.
|
||||
@@ -739,7 +777,7 @@ Phaser.Tilemap.prototype = {
|
||||
/**
|
||||
* Gets the layer index based on its name.
|
||||
*
|
||||
* @method Phaser.Tileset#getLayerIndex
|
||||
* @method Phaser.Tilemap#getLayerIndex
|
||||
* @param {string} name - The name of the layer to get.
|
||||
* @return {number} The index of the layer in this tilemap, or null if not found.
|
||||
*/
|
||||
@@ -752,7 +790,7 @@ Phaser.Tilemap.prototype = {
|
||||
/**
|
||||
* Gets the tileset index based on its name.
|
||||
*
|
||||
* @method Phaser.Tileset#getTilesetIndex
|
||||
* @method Phaser.Tilemap#getTilesetIndex
|
||||
* @param {string} name - The name of the tileset to get.
|
||||
* @return {number} The index of the tileset in this tilemap, or null if not found.
|
||||
*/
|
||||
@@ -765,7 +803,7 @@ Phaser.Tilemap.prototype = {
|
||||
/**
|
||||
* Gets the image index based on its name.
|
||||
*
|
||||
* @method Phaser.Tileset#getImageIndex
|
||||
* @method Phaser.Tilemap#getImageIndex
|
||||
* @param {string} name - The name of the image to get.
|
||||
* @return {number} The index of the image in this tilemap, or null if not found.
|
||||
*/
|
||||
@@ -778,7 +816,7 @@ Phaser.Tilemap.prototype = {
|
||||
/**
|
||||
* Gets the object index based on its name.
|
||||
*
|
||||
* @method Phaser.Tileset#getObjectIndex
|
||||
* @method Phaser.Tilemap#getObjectIndex
|
||||
* @param {string} name - The name of the object to get.
|
||||
* @return {number} The index of the object in this tilemap, or null if not found.
|
||||
*/
|
||||
@@ -793,7 +831,7 @@ Phaser.Tilemap.prototype = {
|
||||
* If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it.
|
||||
* If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.
|
||||
*
|
||||
* @method Phaser.Tileset#setTileIndexCallback
|
||||
* @method Phaser.Tilemap#setTileIndexCallback
|
||||
* @param {number|array} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for.
|
||||
* @param {function} callback - The callback that will be invoked when the tile is collided with.
|
||||
* @param {object} callbackContext - The context under which the callback is called.
|
||||
@@ -824,7 +862,7 @@ Phaser.Tilemap.prototype = {
|
||||
* If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it.
|
||||
* If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.
|
||||
*
|
||||
* @method Phaser.Tileset#setTileLocationCallback
|
||||
* @method Phaser.Tilemap#setTileLocationCallback
|
||||
* @param {number} x - X position of the top left of the area to copy (given in tiles, not pixels)
|
||||
* @param {number} y - Y position of the top left of the area to copy (given in tiles, not pixels)
|
||||
* @param {number} width - The width of the area to copy (given in tiles, not pixels)
|
||||
@@ -855,7 +893,7 @@ Phaser.Tilemap.prototype = {
|
||||
* Sets collision the given tile or tiles. You can pass in either a single numeric index or an array of indexes: [ 2, 3, 15, 20].
|
||||
* The `collides` parameter controls if collision will be enabled (true) or disabled (false).
|
||||
*
|
||||
* @method Phaser.Tileset#setCollision
|
||||
* @method Phaser.Tilemap#setCollision
|
||||
* @param {number|array} indexes - Either a single tile index, or an array of tile IDs to be checked for collision.
|
||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision.
|
||||
* @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer.
|
||||
@@ -889,7 +927,7 @@ Phaser.Tilemap.prototype = {
|
||||
* Calling this with a start value of 10 and a stop value of 14 would set collision for tiles 10, 11, 12, 13 and 14.
|
||||
* The `collides` parameter controls if collision will be enabled (true) or disabled (false).
|
||||
*
|
||||
* @method Phaser.Tileset#setCollisionBetween
|
||||
* @method Phaser.Tilemap#setCollisionBetween
|
||||
* @param {number} start - The first index of the tile to be set for collision.
|
||||
* @param {number} stop - The last index of the tile to be set for collision.
|
||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision.
|
||||
@@ -920,7 +958,7 @@ Phaser.Tilemap.prototype = {
|
||||
* Sets collision on all tiles in the given layer, except for the IDs of those in the given array.
|
||||
* The `collides` parameter controls if collision will be enabled (true) or disabled (false).
|
||||
*
|
||||
* @method Phaser.Tileset#setCollisionByExclusion
|
||||
* @method Phaser.Tilemap#setCollisionByExclusion
|
||||
* @param {array} indexes - An array of the tile IDs to not be counted for collision.
|
||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision.
|
||||
* @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer.
|
||||
@@ -949,7 +987,7 @@ Phaser.Tilemap.prototype = {
|
||||
* Sets collision values on a tile in the set.
|
||||
* You shouldn't usually call this method directly, instead use setCollision, setCollisionBetween or setCollisionByExclusion.
|
||||
*
|
||||
* @method Phaser.Tileset#setCollisionByIndex
|
||||
* @method Phaser.Tilemap#setCollisionByIndex
|
||||
* @protected
|
||||
* @param {number} index - The index of the tile on the layer.
|
||||
* @param {boolean} [collides=true] - If true it will enable collision on the tile. If false it will clear collision values from the tile.
|
||||
@@ -992,7 +1030,7 @@ Phaser.Tilemap.prototype = {
|
||||
/**
|
||||
* Gets the TilemapLayer index as used in the setCollision calls.
|
||||
*
|
||||
* @method Phaser.Tileset#getLayer
|
||||
* @method Phaser.Tilemap#getLayer
|
||||
* @protected
|
||||
* @param {number|string|Phaser.TilemapLayer} layer - The layer to operate on. If not given will default to this.currentLayer.
|
||||
* @return {number} The TilemapLayer index.
|
||||
@@ -1023,7 +1061,7 @@ Phaser.Tilemap.prototype = {
|
||||
/**
|
||||
* Internal function.
|
||||
*
|
||||
* @method Phaser.Tileset#calculateFaces
|
||||
* @method Phaser.Tilemap#calculateFaces
|
||||
* @protected
|
||||
* @param {number} layer - The index of the TilemapLayer to operate on.
|
||||
*/
|
||||
@@ -1080,7 +1118,7 @@ Phaser.Tilemap.prototype = {
|
||||
* Gets the tile above the tile coordinates given.
|
||||
* Mostly used as an internal function by calculateFaces.
|
||||
*
|
||||
* @method Phaser.Tileset#getTileAbove
|
||||
* @method Phaser.Tilemap#getTileAbove
|
||||
* @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
|
||||
* @param {number} x - The x coordinate to get the tile from. In tiles, not pixels.
|
||||
* @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.
|
||||
@@ -1100,7 +1138,7 @@ Phaser.Tilemap.prototype = {
|
||||
* Gets the tile below the tile coordinates given.
|
||||
* Mostly used as an internal function by calculateFaces.
|
||||
*
|
||||
* @method Phaser.Tileset#getTileBelow
|
||||
* @method Phaser.Tilemap#getTileBelow
|
||||
* @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
|
||||
* @param {number} x - The x coordinate to get the tile from. In tiles, not pixels.
|
||||
* @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.
|
||||
@@ -1120,7 +1158,7 @@ Phaser.Tilemap.prototype = {
|
||||
* Gets the tile to the left of the tile coordinates given.
|
||||
* Mostly used as an internal function by calculateFaces.
|
||||
*
|
||||
* @method Phaser.Tileset#getTileLeft
|
||||
* @method Phaser.Tilemap#getTileLeft
|
||||
* @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
|
||||
* @param {number} x - The x coordinate to get the tile from. In tiles, not pixels.
|
||||
* @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.
|
||||
@@ -1140,7 +1178,7 @@ Phaser.Tilemap.prototype = {
|
||||
* Gets the tile to the right of the tile coordinates given.
|
||||
* Mostly used as an internal function by calculateFaces.
|
||||
*
|
||||
* @method Phaser.Tileset#getTileRight
|
||||
* @method Phaser.Tilemap#getTileRight
|
||||
* @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
|
||||
* @param {number} x - The x coordinate to get the tile from. In tiles, not pixels.
|
||||
* @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.
|
||||
@@ -1197,7 +1235,7 @@ Phaser.Tilemap.prototype = {
|
||||
this.layers[layer].data[y][x].index = tile;
|
||||
}
|
||||
|
||||
this.layers[layer].dirty = true;
|
||||
this.layers[layer].dirty = true;
|
||||
this.calculateFaces(layer);
|
||||
}
|
||||
|
||||
@@ -1357,7 +1395,7 @@ Phaser.Tilemap.prototype = {
|
||||
this.layers[layer].data[ diffY + tileblock[i].y ][ diffX + tileblock[i].x ].copy(tileblock[i]);
|
||||
}
|
||||
|
||||
this.layers[layer].dirty = true;
|
||||
this.layers[layer].dirty = true;
|
||||
this.calculateFaces(layer);
|
||||
|
||||
},
|
||||
@@ -1687,7 +1725,7 @@ Phaser.Tilemap.prototype.constructor = Phaser.Tilemap;
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Wed Feb 12 2014 15:23:37 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Wed Feb 12 2014 15:32:12 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