File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
frameworks/js-bindings/bindings/script
samples/js-tests/src/SpineTest Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 22
22
23
23
sp . SkeletonAnimation . prototype . _ctor = function ( skeletonDataFile , atlasFile , scale ) {
24
24
if ( atlasFile ) {
25
- this . initWithFile ( skeletonDataFile , atlasFile , scale ) ;
26
- this . initialize ( ) ;
25
+ if ( isNaN ( scale ) ) {
26
+ scale = 1 ;
27
+ }
28
+
29
+ this . initWithFile ( skeletonDataFile , atlasFile , scale ) ;
30
+ this . initialize ( ) ;
27
31
}
28
32
} ;
29
33
Original file line number Diff line number Diff line change @@ -43,6 +43,13 @@ SpineTestScene = TestScene.extend({
43
43
}
44
44
} ) ;
45
45
46
+ var SpineBoyAnimation = sp . SkeletonAnimation . extend ( {
47
+ ctor : function ( ) {
48
+ this . _super ( 'res/skeletons/spineboy.json' , 'res/skeletons/spineboy.atlas' ) ;
49
+ cc . log ( "Extended SkeletonAnimation" ) ;
50
+ }
51
+ } ) ;
52
+
46
53
touchcount = 0 ;
47
54
48
55
var SpineTest = BaseTestLayer . extend ( {
@@ -82,7 +89,7 @@ var SpineTest = BaseTestLayer.extend({
82
89
// Make Spine's Animated skeleton Node
83
90
// You need 'json + atlas + image' resource files to make it.
84
91
// No JS binding for spine-c in this version. So, only file loading is supported.
85
- var spineBoy = sp . SkeletonAnimation . create ( 'res/skeletons/spineboy.json' , 'res/skeletons/spineboy.atlas' ) ;
92
+ var spineBoy = new SpineBoyAnimation ( ) ;
86
93
spineBoy . setPosition ( cc . p ( size . width / 2 , size . height / 2 - 150 ) ) ;
87
94
spineBoy . setAnimation ( 0 , 'walk' , true ) ;
88
95
spineBoy . setMix ( 'walk' , 'jump' , 0.2 ) ;
You can’t perform that action at this time.
0 commit comments