File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Default Game Object JSON export
2+ // Is extended further by Game Object specific implementations
3+
4+ var ToJSON = function ( gameObject )
5+ {
6+ var out = {
7+ name : gameObject . name ,
8+ type : gameObject . type ,
9+ position : {
10+ x : gameObject . x ,
11+ y : gameObject . y ,
12+ z : gameObject . z
13+ } ,
14+ scale : {
15+ x : gameObject . scaleX ,
16+ y : gameObject . scaleY
17+ } ,
18+ origin : {
19+ x : gameObject . originX ,
20+ y : gameObject . originY
21+ } ,
22+ flip : {
23+ x : gameObject . flipX ,
24+ y : gameObject . flipY
25+ } ,
26+ rotation : gameObject . rotation ,
27+ alpha : gameObject . alpha ,
28+ visible : gameObject . visible ,
29+ scaleMode : gameObject . scaleMode ,
30+ blendMode : gameObject . blendMode ,
31+ textureKey : '' ,
32+ frameKey : ''
33+ } ;
34+
35+ if ( gameObject . texture )
36+ {
37+ out . textureKey = gameObject . texture . key ;
38+ out . frameKey = gameObject . frame . key ;
39+ }
40+
41+ return out ;
42+ } ;
43+
44+ module . exports = ToJSON ;
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module.exports = {
1313 ScaleMode : require ( './ScaleMode' ) ,
1414 Size : require ( './Size' ) ,
1515 Texture : require ( './Texture' ) ,
16+ ToJSON : require ( './ToJSON' ) ,
1617 Transform : require ( './Transform' ) ,
1718 TransformMatrix : require ( './TransformMatrix' ) ,
1819 Visible : require ( './Visible' )
You can’t perform that action at this time.
0 commit comments