Skip to content

Commit 5dffe21

Browse files
committed
Updated jsdocs
1 parent 67f13e3 commit 5dffe21

14 files changed

Lines changed: 194 additions & 93 deletions

src/tilemaps/ParseToTilemap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var Tilemap = require('./Tilemap');
2727
* consumption. However if your map is small or you need to update the tiles dynamically, then leave
2828
* the default value set.
2929
*
30-
* @returns {Phaser.Tilemaps.Tilemap}
30+
* @return {Phaser.Tilemaps.Tilemap}
3131
*/
3232
var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull)
3333
{

src/tilemaps/Tile.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ var Tile = new Class({
296296
*
297297
* @param {Phaser.Tilemaps.Tile} tile - The tile to copy from.
298298
*
299-
* @returns {Phaser.Tilemaps.Tile} This Tile object.
299+
* @return {Phaser.Tilemaps.Tile} This Tile object.
300300
*/
301301
copy: function (tile)
302302
{
@@ -325,7 +325,7 @@ var Tile = new Class({
325325
* @method Phaser.Tilemaps.Tile#getCollisionGroup
326326
* @since 3.0.0
327327
*
328-
* @returns {object|null} tileset
328+
* @return {object|null} tileset
329329
*/
330330
getCollisionGroup: function ()
331331
{
@@ -341,7 +341,7 @@ var Tile = new Class({
341341
* @method Phaser.Tilemaps.Tile#getTileData
342342
* @since 3.0.0
343343
*
344-
* @returns {object|null} tileset
344+
* @return {object|null} tileset
345345
*/
346346
getTileData: function ()
347347
{
@@ -357,7 +357,7 @@ var Tile = new Class({
357357
*
358358
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check.
359359
*
360-
* @returns {number}
360+
* @return {number}
361361
*/
362362
getLeft: function (camera)
363363
{
@@ -375,7 +375,7 @@ var Tile = new Class({
375375
*
376376
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check.
377377
*
378-
* @returns {number}
378+
* @return {number}
379379
*/
380380
getRight: function (camera)
381381
{
@@ -393,7 +393,7 @@ var Tile = new Class({
393393
*
394394
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check.
395395
*
396-
* @returns {number}
396+
* @return {number}
397397
*/
398398
getTop: function (camera)
399399
{
@@ -416,7 +416,7 @@ var Tile = new Class({
416416
*
417417
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check.
418418
*
419-
* @returns {number}
419+
* @return {number}
420420
*/
421421
getBottom: function (camera)
422422
{
@@ -437,7 +437,7 @@ var Tile = new Class({
437437
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check.
438438
* @param {object} [output] - [description]
439439
*
440-
* @returns {Phaser.Geom.Rectangle|object}
440+
* @return {Phaser.Geom.Rectangle|object}
441441
*/
442442
getBounds: function (camera, output)
443443
{
@@ -460,7 +460,7 @@ var Tile = new Class({
460460
*
461461
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check.
462462
*
463-
* @returns {number}
463+
* @return {number}
464464
*/
465465
getCenterX: function (camera)
466466
{
@@ -476,7 +476,7 @@ var Tile = new Class({
476476
*
477477
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check.
478478
*
479-
* @returns {number}
479+
* @return {number}
480480
*/
481481
getCenterY: function (camera)
482482
{
@@ -527,7 +527,7 @@ var Tile = new Class({
527527
* @param {boolean} collides - If true, will consider the tile interesting if it collides on any side.
528528
* @param {boolean} faces - If true, will consider the tile interesting if it has an interesting face.
529529
*
530-
* @returns {boolean} True if the Tile is interesting, otherwise false.
530+
* @return {boolean} True if the Tile is interesting, otherwise false.
531531
*/
532532
isInteresting: function (collides, faces)
533533
{
@@ -545,7 +545,7 @@ var Tile = new Class({
545545
*
546546
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors.
547547
*
548-
* @returns {Phaser.Tilemaps.Tile} This Tile object.
548+
* @return {Phaser.Tilemaps.Tile} This Tile object.
549549
*/
550550
resetCollision: function (recalculateFaces)
551551
{
@@ -580,7 +580,7 @@ var Tile = new Class({
580580
* @method Phaser.Tilemaps.Tile#resetFaces
581581
* @since 3.0.0
582582
*
583-
* @returns {Phaser.Tilemaps.Tile} This Tile object.
583+
* @return {Phaser.Tilemaps.Tile} This Tile object.
584584
*/
585585
resetFaces: function ()
586586
{
@@ -605,7 +605,7 @@ var Tile = new Class({
605605
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces
606606
* for this tile and its neighbors.
607607
*
608-
* @returns {Phaser.Tilemaps.Tile} This Tile object.
608+
* @return {Phaser.Tilemaps.Tile} This Tile object.
609609
*/
610610
setCollision: function (left, right, up, down, recalculateFaces)
611611
{
@@ -647,7 +647,7 @@ var Tile = new Class({
647647
* @param {function} callback - Callback function.
648648
* @param {object} context - Callback will be called within this context.
649649
*
650-
* @returns {Phaser.Tilemaps.Tile} This Tile object.
650+
* @return {Phaser.Tilemaps.Tile} This Tile object.
651651
*/
652652
setCollisionCallback: function (callback, context)
653653
{
@@ -676,7 +676,7 @@ var Tile = new Class({
676676
* @param {integer} baseWidth - The base width a tile in the map (in pixels).
677677
* @param {integer} baseHeight - The base height of the tile in pixels (in pixels).
678678
*
679-
* @returns {Phaser.Tilemaps.Tile} This Tile object.
679+
* @return {Phaser.Tilemaps.Tile} This Tile object.
680680
*/
681681
setSize: function (tileWidth, tileHeight, baseWidth, baseHeight)
682682
{
@@ -696,7 +696,7 @@ var Tile = new Class({
696696
* @method Phaser.Tilemaps.Tile#updatePixelXY
697697
* @since 3.0.0
698698
*
699-
* @returns {Phaser.Tilemaps.Tile} This Tile object.
699+
* @return {Phaser.Tilemaps.Tile} This Tile object.
700700
*/
701701
updatePixelXY: function ()
702702
{

src/tilemaps/Tilemap.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ var Tilemap = new Class({
15711571
* tile faces. If set to null, interesting tile faces will not be drawn.
15721572
* @param {Phaser.Tilemaps.LayerData} layer - [description]
15731573
*
1574-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1574+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
15751575
*/
15761576
renderDebug: function (graphics, styleConfig, layer)
15771577
{
@@ -1603,7 +1603,7 @@ var Tilemap = new Class({
16031603
* @param {integer} [height=max height based on tileY] - [description]
16041604
* @param {Phaser.Tilemaps.LayerData} layer - [description]
16051605
*
1606-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1606+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
16071607
*/
16081608
replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height, layer)
16091609
{
@@ -1636,7 +1636,7 @@ var Tilemap = new Class({
16361636
* update.
16371637
* @param {Phaser.Tilemaps.LayerData} layer - [description]
16381638
*
1639-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1639+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
16401640
*/
16411641
setCollision: function (indexes, collides, recalculateFaces, layer)
16421642
{
@@ -1668,7 +1668,7 @@ var Tilemap = new Class({
16681668
* update.
16691669
* @param {Phaser.Tilemaps.LayerData} layer - [description]
16701670
*
1671-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1671+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
16721672
*/
16731673
setCollisionBetween: function (start, stop, collides, recalculateFaces, layer)
16741674
{
@@ -1703,7 +1703,7 @@ var Tilemap = new Class({
17031703
* update.
17041704
* @param {Phaser.Tilemaps.LayerData} layer - [description]
17051705
*
1706-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1706+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
17071707
*/
17081708
setCollisionByProperty: function (properties, collides, recalculateFaces, layer)
17091709
{
@@ -1733,7 +1733,7 @@ var Tilemap = new Class({
17331733
* update.
17341734
* @param {Phaser.Tilemaps.LayerData} layer - [description]
17351735
*
1736-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1736+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
17371737
*/
17381738
setCollisionByExclusion: function (indexes, collides, recalculateFaces, layer)
17391739
{
@@ -1763,7 +1763,7 @@ var Tilemap = new Class({
17631763
* update.
17641764
* @param {Phaser.Tilemaps.LayerData} layer - [description]
17651765
*
1766-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1766+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
17671767
*/
17681768
setCollisionFromCollisionGroup: function (collides, recalculateFaces, layer)
17691769
{
@@ -1793,7 +1793,7 @@ var Tilemap = new Class({
17931793
* @param {object} callbackContext - The context under which the callback is called.
17941794
* @param {Phaser.Tilemaps.LayerData} layer - [description]
17951795
*
1796-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1796+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
17971797
*/
17981798
setTileIndexCallback: function (indexes, callback, callbackContext, layer)
17991799
{
@@ -1824,7 +1824,7 @@ var Tilemap = new Class({
18241824
* @param {object} callbackContext - The context under which the callback is called.
18251825
* @param {Phaser.Tilemaps.LayerData} layer - [description]
18261826
*
1827-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1827+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
18281828
*/
18291829
setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext, layer)
18301830
{
@@ -1967,7 +1967,7 @@ var Tilemap = new Class({
19671967
* @param {integer} [height=max height based on tileY] - [description]
19681968
* @param {Phaser.Tilemaps.LayerData} layer - [description]
19691969
*
1970-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
1970+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
19711971
*/
19721972
shuffle: function (tileX, tileY, width, height, layer)
19731973
{
@@ -2002,7 +2002,7 @@ var Tilemap = new Class({
20022002
* @param {integer} [height=max height based on tileY] - [description]
20032003
* @param {Phaser.Tilemaps.LayerData} layer - [description]
20042004
*
2005-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
2005+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
20062006
*/
20072007
swapByIndex: function (indexA, indexB, tileX, tileY, width, height, layer)
20082008
{
@@ -2123,7 +2123,7 @@ var Tilemap = new Class({
21232123
* { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes.
21242124
* @param {Phaser.Tilemaps.LayerData} layer - [description]
21252125
*
2126-
* @returns {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
2126+
* @return {Phaser.Tilemaps.Tilemap|null} Return this Tilemap object, or null if the layer given was invalid.
21272127
*/
21282128
weightedRandomize: function (tileX, tileY, width, height, weightedIndexes, layer)
21292129
{

src/tilemaps/TilemapCreator.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
var GameObjectCreator = require('../gameobjects/GameObjectCreator');
22
var ParseToTilemap = require('./ParseToTilemap');
33

4-
// When registering a factory function 'this' refers to the GameObjectCreator context.
5-
64
/**
75
* Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided.
86
* When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing
97
* from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map
108
* data. For an empty map, you should specify tileWidth, tileHeight, width & height.
119
*
10+
* @method Phaser.GameObjects.GameObjectCreator#tilemap
11+
* @since 3.0.0
12+
*
1213
* @param {object} [config] - The config options for the Tilemap.
1314
* @param {string} [config.key] - The key in the Phaser cache that corresponds to the loaded tilemap
1415
* data.
@@ -24,12 +25,24 @@ var ParseToTilemap = require('./ParseToTilemap');
2425
* map and the tile data doesn't need to change then setting this value to `true` will help with
2526
* memory consumption. However if your map is small or you need to update the tiles dynamically,
2627
* then leave the default value set.
27-
* @returns {Tilemap}
28+
*
29+
* @return {Phaser.Tilemaps.Tilemap}
2830
*/
2931
GameObjectCreator.register('tilemap', function (config)
3032
{
3133
// Defaults are applied in ParseToTilemap
32-
var c = config !== undefined ? config : {};
33-
return ParseToTilemap(this.scene, c.key, c.tileWidth, c.tileHeight, c.width, c.height, c.data,
34-
c.insertNull);
34+
var c = (config !== undefined) ? config : {};
35+
36+
return ParseToTilemap(
37+
this.scene,
38+
c.key,
39+
c.tileWidth,
40+
c.tileHeight,
41+
c.width,
42+
c.height,
43+
c.data,
44+
c.insertNull
45+
);
3546
});
47+
48+
// When registering a factory function 'this' refers to the GameObjectCreator context.

src/tilemaps/TilemapFactory.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
var GameObjectFactory = require('../gameobjects/GameObjectFactory');
22
var ParseToTilemap = require('./ParseToTilemap');
33

4-
// When registering a factory function 'this' refers to the GameObjectFactory context.
5-
//
6-
// There are several properties available to use:
7-
//
8-
// this.scene - a reference to the Scene that owns the GameObjectFactory
9-
// this.displayList - a reference to the Display List the Scene owns
10-
// this.updateList - a reference to the Update List the Scene owns
11-
124
/**
135
* Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided.
146
* When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing
157
* from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map
168
* data. For an empty map, you should specify tileWidth, tileHeight, width & height.
179
*
10+
* @method Phaser.GameObjects.GameObjectFactory#tilemap
11+
* @since 3.0.0
12+
*
1813
* @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data.
1914
* @param {integer} [tileWidth=32] - The width of a tile in pixels. Pass in `null` to leave as the
2015
* default.
@@ -32,13 +27,15 @@ var ParseToTilemap = require('./ParseToTilemap');
3227
* the tile data doesn't need to change then setting this value to `true` will help with memory
3328
* consumption. However if your map is small or you need to update the tiles dynamically, then leave
3429
* the default value set.
35-
* @returns {Tilemap}
30+
*
31+
* @return {Phaser.Tilemaps.Tilemap}
3632
*/
3733
GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, width, height, data, insertNull)
3834
{
3935
// Allow users to specify null to indicate that they want the default value, since null is
4036
// shorter & more legible than undefined. Convert null to undefined to allow ParseToTilemap
4137
// defaults to take effect.
38+
4239
if (key === null) { key = undefined; }
4340
if (tileWidth === null) { tileWidth = undefined; }
4441
if (tileHeight === null) { tileHeight = undefined; }
@@ -47,3 +44,11 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt
4744

4845
return ParseToTilemap(this.scene, key, tileWidth, tileHeight, width, height, data, insertNull);
4946
});
47+
48+
// When registering a factory function 'this' refers to the GameObjectFactory context.
49+
//
50+
// There are several properties available to use:
51+
//
52+
// this.scene - a reference to the Scene that owns the GameObjectFactory
53+
// this.displayList - a reference to the Display List the Scene owns
54+
// this.updateList - a reference to the Update List the Scene owns

0 commit comments

Comments
 (0)