diff --git a/src/tilemap/TilemapLayer.js b/src/tilemap/TilemapLayer.js index 0adef58f6..a5485d959 100644 --- a/src/tilemap/TilemapLayer.js +++ b/src/tilemap/TilemapLayer.js @@ -25,7 +25,7 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * A reference to the currently running Game. - * @member {Phaser.Game} + * @property {Phaser.Game} game * @protected * @readonly */ @@ -33,7 +33,7 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * The Tilemap to which this layer is bound. - * @member {Phaser.Tilemap} + * @property {Phaser.Tilemap} map * @protected * @readonly */ @@ -41,7 +41,7 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * The layer object within the Tilemap that this layer represents. - * @member {Phaser.TileLayer} + * @property {Phaser.TileLayer} layer * @protected * @readonly */ @@ -49,35 +49,36 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * The canvas to which this TilemapLayer draws. - * @member {HTMLCanvasElement} + * @property {HTMLCanvasElement} canvas * @protected */ this.canvas = Phaser.Canvas.create(width, height, '', true); /** * The 2d context of the canvas. - * @member {CanvasRenderingContext2D} + * @property {CanvasRenderingContext2D} context * @private */ this.context = this.canvas.getContext('2d'); /** * Required Pixi var. - * @member {PIXI.BaseTexture} + * @property {PIXI.BaseTexture} baseTexture * @protected */ this.baseTexture = new PIXI.BaseTexture(this.canvas); /** * Required Pixi var. - * @member {PIXI.Texture} + * @property {PIXI.Texture} texture * @protected */ this.texture = new PIXI.Texture(this.baseTexture); /** * Dimensions of the renderable area. - * @member {Phaser.Frame} + * @property {Phaser.Frame} textureFrame + * @protected */ this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'tilemapLayer', game.rnd.uuid()); @@ -85,13 +86,13 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * The name of the layer. - * @member {string} + * @property {string} name */ this.name = ''; /** * The const type of this object. - * @member {number} + * @property {number} type * @readonly * @protected * @default Phaser.TILEMAPLAYER @@ -100,25 +101,22 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * An object that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera. - * @member {boolean} + * @property {boolean} fixToCamera * @default */ this.fixedToCamera = true; /** * If this object is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered. - * @member {Phaser.Point} + * @property {Phaser.Point} cameraOffset */ this.cameraOffset = new Phaser.Point(0, 0); /** * Settings that control standard (non-diagnostic) rendering. * - * @member * @public - * * @property {boolean} enableScrollDelta - When enabled, only new newly exposed areas of the layer are redraw after scrolling. This can greatly improve scrolling rendering performance, especially when there are many small tiles. - * * @default */ this.renderSettings = { @@ -131,7 +129,7 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * Enable an additional "debug rendering" pass to display collision information. * - * @member {boolean} + * @property {boolean} debug * @default */ this.debug = false; @@ -139,9 +137,6 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * Settings used for debugging and diagnostics. * - * @member - * @public - * * @property {?string} missingImageFill - A tile is rendered as a rectangle using the following fill if a valid tileset/image cannot be found. A value of `null` prevents additional rendering for tiles without a valid tileset image. _This takes effect even when debug rendering for the layer is not enabled._ * * @property {?string} debuggedTileOverfill - If a Tile has `Tile#debug` true then, after normal tile image rendering, a rectangle with the following fill is drawn above/over it. _This takes effect even when debug rendering for the layer is not enabled._ @@ -171,45 +166,44 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * Speed at which this layer scrolls horizontally, relative to the camera (e.g. scrollFactorX of 0.5 scrolls half as quickly as the 'normal' camera-locked layers do). * - * @member {number} - * @public - * @default 1 + * @property {number} scrollFactorX + * @default */ this.scrollFactorX = 1; /** * Speed at which this layer scrolls vertically, relative to the camera (e.g. scrollFactorY of 0.5 scrolls half as quickly as the 'normal' camera-locked layers do) - * @member {number} + * @property {number} scrollFactorY * @public - * @default 1 + * @default */ this.scrollFactorY = 1; /** * If true tiles will be force rendered, even if such is not believed to be required. - * @member {boolean} dirty + * @property {boolean} dirty * @protected */ this.dirty = true; /** * When ray-casting against tiles this is the number of steps it will jump. For larger tile sizes you can increase this to improve performance. - * @member {integer} + * @property {integer} rayStepRate * @default */ this.rayStepRate = 4; /** * Flag controlling if the layer tiles wrap at the edges. - * @member {boolean} - * @default + * @property {boolean} _wrap * @private + * @default */ this._wrap = false; /** * Local map data and calculation cache. - * @member {object} + * @property {object} _mc * @private */ this._mc = { @@ -236,21 +230,21 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) { /** * The current canvas left after scroll is applied. - * @member {number} + * @property {number} _scrollX * @private */ this._scrollX = 0; /** * The current canvas top after scroll is applied. - * @member {number} + * @propety {number} _scrollY * @private */ this._scrollY = 0; /** * Used for caching the tiles / array of tiles. - * @member {Phaser.Tile[]} + * @property {Phaser.Tile[]} _results * @private */ this._results = []; @@ -263,7 +257,7 @@ Phaser.TilemapLayer.prototype.constructor = Phaser.TilemapLayer; /** * The index of this layer (`layer`) within the Tilemap. * -* @member {integer} #index +* @property {integer} index * @memberof Phaser.TilemapLayer * @readonly * @protected @@ -281,7 +275,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, 'index', { * * Set to `null` to disable rendering anything for tiles without value tileset images. * -* @member {?string} #tileColor +* @property {?string} tileColor * @memberof Phaser.TilemapLayer * @default 'rgb(255, 255, 255)' * @deprecated Use `debugSettings.missingImageFill` instead. @@ -574,7 +568,7 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides /** * Flag controlling if the layer tiles wrap at the edges. Only works if the World size matches the Map size. * -* @member {boolean} #wrap +* @property {boolean} wrap * @memberof Phaser.TilemapLayer * @public * @default false @@ -1082,7 +1076,7 @@ Phaser.TilemapLayer.prototype.renderDebug = function () { /** * Scrolls the map horizontally or returns the current x position. * -* @member {number} #scrollX +* @property {number} scrollX * @memberof Phaser.TilemapLayer * @public */ @@ -1101,7 +1095,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollX", { /** * Scrolls the map vertically or returns the current y position. * -* @member {number} #scrollY +* @property {number} scrollY * @memberof Phaser.TilemapLayer * @public */ @@ -1120,7 +1114,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollY", { /** * The width of the collision tiles (in pixels). * -* @member {number} #collisionWidth +* @property {integer} collisionWidth * @memberof Phaser.TilemapLayer * @public */ @@ -1131,7 +1125,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionWidth", { }, set: function (value) { - this._mc.cw = value; + this._mc.cw = value | 0; this.dirty = true; } @@ -1140,7 +1134,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionWidth", { /** * The height of the collision tiles (in pixels). * -* @member {number} #collisionHeight +* @property {integer} collisionHeight * @memberof Phaser.TilemapLayer * @public */ @@ -1151,7 +1145,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", { }, set: function (value) { - this._mc.ch = value; + this._mc.ch = value | 0; this.dirty = true; } diff --git a/src/tilemap/Tileset.js b/src/tilemap/Tileset.js index 89b61f713..33ac41e37 100644 --- a/src/tilemap/Tileset.js +++ b/src/tilemap/Tileset.js @@ -28,57 +28,64 @@ Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, prope /** * The name of the Tileset. - * @member {string} + * @property {string} name */ this.name = name; /** * The Tiled firstgid value. * This is the starting index of the first tile index this Tileset contains. - * @member {integer} + * @property {integer} firstgid */ this.firstgid = firstgid | 0; /** * The width of each tile (in pixels). - * @member {integer} + * @property {integer} tileWidth + * @readonly */ this.tileWidth = width | 0; /** * The height of each tile (in pixels). - * @member {integer} + * @property {integer} tileHeight + * @readonly */ this.tileHeight = height | 0; /** * The margin around the tiles in the sheet (in pixels). - * @member {integer} + * Use `setSpacing` to change. + * @property {integer} tileMarge + * @readonly */ + // Modified internally this.tileMargin = margin | 0; /** * The spacing between each tile in the sheet (in pixels). - * @member {integer} + * Use `setSpacing` to change. + * @property {integer} tileSpacing */ this.tileSpacing = spacing | 0; /** * Tileset-specific properties that are typically defined in the Tiled editor. - * @member {object} + * @property {object} properties */ this.properties = properties || {}; /** * The cached image that contains the individual tiles. Use `setImage` to set. - * @member {?object} + * @property {?object} image + * @readonly */ // Modified internally this.image = null; /** * The number of rows in the tile sheet. - * @member {integer} + * @property {integer} * @readonly */ // Modified internally @@ -86,7 +93,7 @@ Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, prope /** * The number of columns in the sheet. - * @member {integer} + * @property {integer} columns * @readonly */ // Modified internally @@ -94,7 +101,7 @@ Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, prope /** * The total number of tiles in the sheet. - * @member {integer} + * @property {integer} total * @readonly */ // Modified internally @@ -103,7 +110,7 @@ Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, prope /** * The look-up table to specific tile image offsets. * The coordinates are interlaced such that it is [x0, y0, x1, y1 .. xN, yN] and the tile with the index of firstgid is found at indices 0/1. - * @member {integer[]} + * @property {integer[]} drawCoords * @private */ this.drawCoords = [];