@@ -10,6 +10,15 @@ module Phaser {
1010
1111 export class Tile {
1212
13+ /**
14+ * Tile constructor
15+ * Create a new <code>Tile</code>.
16+ *
17+ * @param tilemap the tilemap this tile belongs to.
18+ * @param index The index of this tile type in the core map data.
19+ * @param width Width of the tile.
20+ * @param height Height of the tile.
21+ */
1322 constructor ( game : Game , tilemap : Tilemap , index : number , width : number , height : number ) {
1423
1524 this . _game = game ;
@@ -22,34 +31,82 @@ module Phaser {
2231
2332 }
2433
34+ /**
35+ * Local private reference to game.
36+ */
2537 private _game : Game ;
2638
27- // You can give this Tile a friendly name to help with debugging. Never used internally.
39+ /**
40+ * You can give this Tile a friendly name to help with debugging. Never used internally.
41+ * @type {string }
42+ */
2843 public name : string ;
2944
45+ /**
46+ * The virtual mass of the tile.
47+ * @type {number }
48+ */
3049 public mass : number = 1.0 ;
50+ /**
51+ * Tile width.
52+ * @type {number }
53+ */
3154 public width : number ;
55+ /**
56+ * Tile height.
57+ * @type {number }
58+ */
3259 public height : number ;
3360
61+ /**
62+ * Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating collision directions.
63+ * @type {number }
64+ */
3465 public allowCollisions : number ;
3566
67+ /**
68+ * Indicating collide with any object on the left.
69+ * @type {boolean }
70+ */
3671 public collideLeft : bool = false ;
72+ /**
73+ * Indicating collide with any object on the right.
74+ * @type {boolean }
75+ */
3776 public collideRight : bool = false ;
77+ /**
78+ * Indicating collide with any object on the top.
79+ * @type {boolean }
80+ */
3881 public collideUp : bool = false ;
82+ /**
83+ * Indicating collide with any object on the bottom.
84+ * @type {boolean }
85+ */
3986 public collideDown : bool = false ;
4087
88+ /**
89+ * Enable separation at x-axis.
90+ * @type {boolean }
91+ */
4192 public separateX : bool = true ;
93+ /**
94+ * Enable separation at y-axis.
95+ * @type {boolean }
96+ */
4297 public separateY : bool = true ;
4398
4499 /**
45100 * A reference to the tilemap this tile object belongs to.
101+ * @type {Tilemap }
46102 */
47103 public tilemap : Tilemap ;
48104
49105 /**
50106 * The index of this tile type in the core map data.
51107 * For example, if your map only has 16 kinds of tiles in it,
52108 * this number is usually between 0 and 15.
109+ * @type {number }
53110 */
54111 public index : number ;
55112
@@ -62,6 +119,13 @@ module Phaser {
62119
63120 }
64121
122+ /**
123+ * Set collision configs.
124+ * @param collision Bit field of flags. (see Tile.allowCollision)
125+ * @param resetCollisions Reset collision flags before set.
126+ * @param separateX Enable seprate at x-axis.
127+ * @param separateY Enable seprate at y-axis.
128+ */
65129 public setCollision ( collision : number , resetCollisions : bool , separateX : bool , separateY : bool ) {
66130
67131 if ( resetCollisions )
@@ -105,6 +169,9 @@ module Phaser {
105169
106170 }
107171
172+ /**
173+ * Reset collision status flags.
174+ */
108175 public resetCollision ( ) {
109176
110177 this . allowCollisions = Collision . NONE ;
0 commit comments