-
Notifications
You must be signed in to change notification settings - Fork 7
/
Tile.js
executable file
·41 lines (40 loc) · 914 Bytes
/
Tile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
define([ './jo', './Point', './Surface', './Sprite' ],
function(jo, Point, Surface, Sprite ) {
/**
* @class handles tiles, works together with TileSet
*/
jo.Tile = jo.Class.extend(
/**
* @lends jo.tile.prototype
*/
{
/**
* @constructs
* @param tileSet
* @param index
* @param material
*/
init : function(tileSet, index, material) {
this.index = index;
this.material = material;
this.tileSet = tileSet;
},
/**
* drawing
* @param options
* @param position
* @param surface
* @see jo.Sprite.draw
*/
draw : function(options, position, surface) {
options.tile = this.index;
this.tileSet.draw(options, position, surface);
if (sys.debug) {
if (typeof this.material.debugColor !== undefined) {
screen.rect({fill: this.material.debugColor}, position, this.tileSet.width, this.tileSet.height);
}
}
}
});
return jo.Tile;
});