forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectLayer.js
More file actions
100 lines (87 loc) · 2.54 KB
/
ObjectLayer.js
File metadata and controls
100 lines (87 loc) · 2.54 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var Class = require('../../utils/Class');
var GetFastValue = require('../../utils/object/GetFastValue');
/**
* @classdesc
* A class for representing a Tiled object layer in a map. This mirrors the structure of a Tiled
* object layer, except:
* - "x" & "y" properties are ignored since these cannot be changed in Tiled.
* - "offsetx" & "offsety" are applied to the individual object coordinates directly, so they
* are ignored as well.
* - "draworder" is ignored.
*
* @class ObjectLayer
* @memberOf Phaser.Tilemaps
* @constructor
* @since 3.0.0
*
* @param {object} [config] - [description]
*/
var ObjectLayer = new Class({
initialize:
function ObjectLayer (config)
{
if (config === undefined) { config = {}; }
/**
* [description]
*
* @name Phaser.Tilemaps.ObjectLayer#name
* @type {string}
* @since 3.0.0
*/
this.name = GetFastValue(config, 'name', 'object layer');
/**
* [description]
*
* @name Phaser.Tilemaps.ObjectLayer#opacity
* @type {number}
* @since 3.0.0
*/
this.opacity = GetFastValue(config, 'opacity', 1);
/**
* [description]
*
* @name Phaser.Tilemaps.ObjectLayer#properties
* @type {object}
* @since 3.0.0
*/
this.properties = GetFastValue(config, 'properties', {});
/**
* [description]
*
* @name Phaser.Tilemaps.ObjectLayer#propertyTypes
* @type {object}
* @since 3.0.0
*/
this.propertyTypes = GetFastValue(config, 'propertytypes', {});
/**
* [description]
*
* @name Phaser.Tilemaps.ObjectLayer#type
* @type {string}
* @since 3.0.0
*/
this.type = GetFastValue(config, 'type', 'objectgroup');
/**
* [description]
*
* @name Phaser.Tilemaps.ObjectLayer#visible
* @type {boolean}
* @since 3.0.0
*/
this.visible = GetFastValue(config, 'visible', true);
/**
* [description]
*
* @name Phaser.Tilemaps.ObjectLayer#objects
* @type {array}
* @since 3.0.0
*/
this.objects = GetFastValue(config, 'objects', []);
}
});
module.exports = ObjectLayer;