- Uređeno
spine output is not working?
used spine to generate 3 files:003.atlas,003.json,003.png, and want to put it into cocos2d-x 3.4, then create a scene HelloWorld to test, but not working:
003.atlas
003.png
size: 1024,256
format: RGBA8888
filter: Linear,Linear
repeat: none
body
rotate: false
xy: 856, 182
size: 81, 72
orig: 81, 72
offset: 0, 0
index: -1
eye1
rotate: false
xy: 399, 72
size: 62, 43
orig: 62, 43
offset: 0, 0
index: -1
eye2
rotate: false
xy: 463, 72
size: 62, 43
orig: 62, 43
offset: 0, 0
index: -1
fx1
rotate: false
xy: 399, 117
size: 175, 137
orig: 175, 137
offset: 0, 0
index: -1
fx2
rotate: false
xy: 939, 192
size: 60, 62
orig: 60, 62
offset: 0, 0
index: -1
fx3
rotate: false
xy: 2, 101
size: 196, 153
orig: 196, 153
offset: 0, 0
index: -1
head1
rotate: false
xy: 200, 104
size: 197, 150
orig: 197, 150
offset: 0, 0
index: -1
head2
rotate: true
xy: 2, 5
size: 94, 108
orig: 94, 108
offset: 0, 0
index: -1
larm1
rotate: true
xy: 112, 2
size: 25, 27
orig: 25, 27
offset: 0, 0
index: -1
larm2
rotate: false
xy: 527, 72
size: 41, 43
orig: 41, 43
offset: 0, 0
index: -1
lleg
rotate: true
xy: 681, 94
size: 53, 92
orig: 53, 92
offset: 0, 0
index: -1
lwing
rotate: false
xy: 770, 184
size: 84, 70
orig: 84, 70
offset: 0, 0
index: -1
neck
rotate: false
xy: 1001, 236
size: 19, 18
orig: 19, 18
offset: 0, 0
index: -1
rarm1
rotate: true
xy: 770, 149
size: 33, 27
orig: 33, 27
offset: 0, 0
index: -1
rarm2
rotate: false
xy: 799, 154
size: 28, 28
orig: 28, 28
offset: 0, 0
index: -1
rarm3
rotate: false
xy: 141, 5
size: 23, 22
orig: 23, 22
offset: 0, 0
index: -1
rleg
rotate: true
xy: 576, 101
size: 46, 103
orig: 46, 103
offset: 0, 0
index: -1
rwing
rotate: false
xy: 112, 29
size: 84, 70
orig: 84, 70
offset: 0, 0
index: -1
weapon
rotate: false
xy: 576, 149
size: 192, 105
orig: 192, 105
offset: 0, 0
index: -1
003.json
{
"skeleton": { "hash": "0YxLn+txsPviIJtGjMcViMBrEp4", "spine": "2.1.11", "width": 202.03, "height": 269.03, "images": "./../003/images/" },
"bones": [
{ "name": "root" },
{ "name": "FX1", "parent": "root", "x": 1.48, "y": 124.01 },
{ "name": "FX2", "parent": "root", "x": -43.89, "y": 139.87 },
{ "name": "FX3", "parent": "root", "color": "ffffffff" },
{ "name": "HIP", "parent": "root", "x": -12.1, "y": 109.66 },
{ "name": "ARM L", "parent": "HIP", "length": 23.07, "x": 36.67, "y": 45.07, "rotation": -61.29 },
{ "name": "ARM R", "parent": "HIP", "length": 24.05, "x": 7.25, "y": 40.87, "rotation": -137.1 },
{ "name": "BODY", "parent": "HIP", "length": 49.73, "x": 1.14, "y": -1.14, "rotation": 65.08 },
{ "name": "LEG L", "parent": "HIP", "length": 38.05, "x": 18.71, "y": -3.43, "rotation": -107.48 },
{ "name": "LEG R", "parent": "HIP", "length": 38.9, "x": -18.33, "y": -3.81, "rotation": -82.81 },
{ "name": "NECK", "parent": "BODY", "length": 10.7, "x": 49.86, "y": -1.25, "rotation": 22.81 },
{ "name": "WING L", "parent": "BODY", "length": 49.13, "x": 55.65, "y": -8.25, "rotation": -34.71 },
{ "name": "WING R", "parent": "BODY", "length": 48.71, "x": 49.88, "y": 11.39, "rotation": 86.39 },
{ "name": "bone5", "parent": "ARM L", "length": 24.95, "x": 23.23, "y": -0.52, "rotation": -3.15 },
{ "name": "bone7", "parent": "ARM R", "length": 19.18, "x": 25.39, "y": 0.38, "rotation": 0.9 },
{ "name": "HEAD", "parent": "NECK", "length": 19.34, "x": 11.46, "y": 0.05, "rotation": 11.13 },
{ "name": "bone8", "parent": "bone7", "length": 7.86, "x": 19.71, "y": 0.13, "rotation": 17.07 },
{ "name": "bone9", "parent": "bone8", "length": 49.01, "x": 7.82, "y": 0.85, "rotation": 104.14 }
],
"slots": [
{ "name": "fx3", "bone": "FX3", "attachment": "fx3" },
{ "name": "weapon", "bone": "bone9", "attachment": "weapon" },
{ "name": "lleg", "bone": "LEG L", "attachment": "lleg" },
{ "name": "rleg", "bone": "LEG R", "attachment": "rleg" },
{ "name": "rarm1", "bone": "ARM R", "attachment": "rarm1" },
{ "name": "rarm2", "bone": "bone7", "attachment": "rarm2" },
{ "name": "rarm3", "bone": "bone8", "attachment": "rarm3" },
{ "name": "head2", "bone": "HEAD", "attachment": "head2" },
{ "name": "rwing", "bone": "WING R", "attachment": "rwing" },
{ "name": "lwing", "bone": "WING L", "attachment": "lwing" },
{ "name": "body", "bone": "BODY", "attachment": "body" },
{ "name": "larm2", "bone": "bone5", "attachment": "larm2" },
{ "name": "larm1", "bone": "ARM L", "attachment": "larm1" },
{ "name": "neck", "bone": "NECK", "attachment": "neck" },
{ "name": "head1", "bone": "HEAD", "attachment": "head1" },
{ "name": "eye1", "bone": "HEAD", "attachment": "eye1" },
{ "name": "eye2", "bone": "HEAD", "attachment": "eye2" },
{ "name": "fx2", "bone": "FX2", "attachment": "fx2" },
{ "name": "fx4", "bone": "FX1", "attachment": "fx1" }
],
"skins": {
"default": {
"body": {
"body": { "x": 17.17, "y": 4.51, "rotation": -65.08, "width": 81, "height": 72 }
},
"eye1": {
"eye1": { "x": 19.04, "y": -0.11, "rotation": -99.03, "width": 62, "height": 43 }
},
"eye2": {
"eye2": { "x": 19.04, "y": -0.11, "rotation": -99.03, "width": 62, "height": 43 }
},
"fx2": {
"fx2": { "width": 60, "height": 62 }
},
"fx3": {
"fx3": { "x": 5.68, "y": 76.5, "width": 196, "height": 153 }
},
"fx4": {
"fx1": { "x": 5.69, "y": 17.48, "width": 175, "height": 137 }
},
"head1": {
"head1": { "x": 29.65, "y": -0.28, "rotation": -99.03, "width": 197, "height": 150 }
},
"head2": {
"head2": { "x": -0.16, "y": -3.13, "rotation": -99.03, "width": 94, "height": 108 }
},
"larm1": {
"larm1": { "x": 12.95, "y": -1.83, "rotation": 61.29, "width": 25, "height": 27 }
},
"larm2": {
"larm2": { "x": 17.46, "y": 2.64, "rotation": 64.44, "width": 41, "height": 43 }
},
"lleg": {
"lleg": { "x": 38.2, "y": 12.61, "rotation": 107.48, "width": 53, "height": 92 }
},
"lwing": {
"lwing": { "x": 45.18, "y": -7.34, "rotation": -30.36, "width": 84, "height": 70 }
},
"neck": {
"neck": { "x": 5.74, "y": 1.22, "rotation": -87.89, "width": 19, "height": 18 }
},
"rarm1": {
"rarm1": { "x": 13.45, "y": -0.16, "rotation": 137.1, "width": 33, "height": 27 }
},
"rarm2": {
"rarm2": { "x": 10, "y": -1.32, "rotation": 136.19, "width": 28, "height": 28 }
},
"rarm3": {
"rarm3": { "x": 5.38, "y": -1, "rotation": 119.12, "width": 23, "height": 22 }
},
"rleg": {
"rleg": { "x": 44.64, "y": -0.45, "rotation": 82.81, "width": 46, "height": 103 }
},
"rwing": {
"rwing": { "x": 48.63, "y": 11.14, "rotation": -151.47, "width": 84, "height": 70 }
},
"weapon": {
"weapon": { "x": 40.37, "y": 4.09, "rotation": 14.98, "width": 192, "height": 105 }
}
}
},
"animations": {
"atk": {
"slots": {
"fx2": {
"color": [
{ "time": 0, "color": "ffffff00", "curve": "stepped" },
{ "time": 0.7666, "color": "ffffff00" },
{ "time": 0.8333, "color": "ffffffff" },
{ "time": 0.8666, "color": "ff26d5ff" },
{ "time": 1.0333, "color": "ffffffff" },
{ "time": 1.1666, "color": "ff26d5ff" },
{ "time": 1.3, "color": "ffffffff" },
{ "time": 1.4666, "color": "ffffff00" }
]
},
"fx3": {
"color": [
{ "time": 0, "color": "ffffffff" },
{ "time": 0.3666, "color": "ff4787ff" },
{ "time": 0.6666, "color": "ffffffff" },
{ "time": 0.8, "color": "ff596fff" },
{ "time": 0.8666, "color": "ffffffff" },
{ "time": 1, "color": "ff596fff" },
{ "time": 1.0666, "color": "ffffffff" },
{ "time": 1.2, "color": "ff596fff" },
{ "time": 1.2666, "color": "ffffffff" },
{ "time": 1.4, "color": "ff596fff" },
{ "time": 1.5, "color": "ffffffff" }
]
},
"fx4": {
"color": [
{ "time": 0, "color": "ffffff00", "curve": "stepped" },
{ "time": 0.1333, "color": "ffffff00" },
{ "time": 0.2, "color": "ffffffff" },
{ "time": 0.3, "color": "ffffff00", "curve": "stepped" },
{ "time": 0.3666, "color": "ffffff00" },
{ "time": 0.4333, "color": "ffffffff" },
{ "time": 0.5333, "color": "ffffff00", "curve": "stepped" },
{ "time": 0.8666, "color": "ffffff00" },
{ "time": 0.9333, "color": "ffffffff" },
{ "time": 1.0333, "color": "ffffff00", "curve": "stepped" },
{ "time": 1.1, "color": "ffffff00" },
{ "time": 1.1666, "color": "ffffffff" },
{ "time": 1.3, "color": "ffffff00" }
]
}
},
"bones": {
"HIP": {
"rotate": [
{ "time": 0, "angle": 0, "curve": "stepped" },
{ "time": 0.6666, "angle": 0 },
{ "time": 0.8, "angle": -17.97, "curve": "stepped" },
{ "time": 1.3333, "angle": -17.97 },
{ "time": 1.6666, "angle": 0 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{ "time": 0.1333, "x": 0, "y": -14.88, "curve": "stepped" },
{ "time": 0.6666, "x": 0, "y": -14.88 },
{ "time": 0.8, "x": 0, "y": 46.87, "curve": "stepped" },
{ "time": 1.3333, "x": 0, "y": 46.87 },
{ "time": 1.6666, "x": 0, "y": 0 }
]
},
"LEG R": {
"rotate": [
{ "time": 0, "angle": 0 },
{ "time": 0.1333, "angle": -9.71, "curve": "stepped" },
{ "time": 1.3333, "angle": -9.71 },
{ "time": 1.6666, "angle": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1 },
{ "time": 0.1333, "x": 0.925, "y": 1.097, "curve": "stepped" },
{ "time": 1.3333, "x": 0.925, "y": 1.097 },
{ "time": 1.6666, "x": 1, "y": 1 }
]
},
"LEG L": {
"rotate": [
{ "time": 0, "angle": 0 },
{ "time": 0.1333, "angle": 13.97, "curve": "stepped" },
{ "time": 1.3333, "angle": 13.97 },
{ "time": 1.6666, "angle": 0 }
],
"translate": [
{ "time": 0.0666, "x": 0, "y": 0 },
{ "time": 0.1333, "x": -0.18, "y": -2.96, "curve": "stepped" },
{ "time": 1.3333, "x": -0.18, "y": -2.96 },
{ "time": 1.5333, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.0666, "x": 1, "y": 1 },
{ "time": 0.1333, "x": 1.072, "y": 1.005, "curve": "stepped" },
{ "time": 1.3333, "x": 1.072, "y": 1.005 },
{ "time": 1.5333, "x": 1, "y": 1 }
]
},
"BODY": {
"rotate": [
{ "time": 0.0666, "angle": 0 },
{ "time": 0.1333, "angle": 9.09, "curve": "stepped" },
{ "time": 1.3333, "angle": 9.09 },
{ "time": 1.5333, "angle": 0 }
],
"translate": [
{ "time": 0.0666, "x": 0, "y": 0 },
{ "time": 0.1333, "x": -0.97, "y": -3.44, "curve": "stepped" },
{ "time": 1.3333, "x": -0.97, "y": -3.44 },
{ "time": 1.5333, "x": 0, "y": 0 }
]
},
"WING R": {
"rotate": [
{ "time": 0, "angle": 0 },
{ "time": 0.0333, "angle": -12.76 },
{ "time": 0.1333, "angle": 0, "curve": "stepped" },
{ "time": 0.6, "angle": 0 },
{ "time": 0.7333, "angle": 11.18 },
{ "time": 0.8666, "angle": 0 },
{ "time": 1, "angle": 11.18 },
{ "time": 1.1333, "angle": 0 },
{ "time": 1.2666, "angle": 11.18 },
{ "time": 1.4, "angle": 0 },
{ "time": 1.5333, "angle": 11.18 },
{ "time": 1.6666, "angle": 0 }
]
},
"WING L": {
"rotate": [
{ "time": 0, "angle": -7.87 },
{ "time": 0.0333, "angle": 12.76 },
{ "time": 0.1333, "angle": -1.36, "curve": "stepped" },
{ "time": 0.6, "angle": -1.36 },
{ "time": 0.7333, "angle": -21.6 },
{ "time": 0.8666, "angle": -1.36 },
{ "time": 1, "angle": -21.6 },
{ "time": 1.1333, "angle": -1.36 },
{ "time": 1.2666, "angle": -21.6 },
{ "time": 1.4, "angle": -1.36 },
{ "time": 1.5333, "angle": -21.6 },
{ "time": 1.6666, "angle": -7.87 }
]
},
"ARM L": {
"rotate": [
{ "time": 0.1, "angle": 0 },
{ "time": 0.6666, "angle": -109.73 },
{ "time": 0.8, "angle": 24.04, "curve": "stepped" },
{ "time": 1.4666, "angle": 24.04 },
{ "time": 1.6, "angle": 0 }
]
},
"bone5": {
"rotate": [
{ "time": 0.6666, "angle": 0 },
{ "time": 0.8, "angle": 29.17, "curve": "stepped" },
{ "time": 1.4666, "angle": 29.17 },
{ "time": 1.6, "angle": 0 }
]
},
"ARM R": {
"rotate": [
{ "time": 0.6666, "angle": 0 },
{ "time": 0.8666, "angle": 313.88 },
{ "time": 1.4666, "angle": -46.11 },
{ "time": 1.6, "angle": 0 }
]
},
"bone7": {
"rotate": [
{ "time": 0.7333, "angle": 0.32 },
{ "time": 0.8666, "angle": -10.79, "curve": "stepped" },
{ "time": 1.4666, "angle": -10.79 },
{ "time": 1.6, "angle": 0 }
]
},
"FX2": {
"translate": [
{ "time": 0.7666, "x": -18.59, "y": 70.68 },
{ "time": 0.8, "x": -6.88, "y": 97.83 },
{ "time": 0.8333, "x": -0.37, "y": 105.64 },
{ "time": 0.8666, "x": 8.18, "y": 110.85 },
{ "time": 1.3666, "x": 8.92, "y": 110.85 },
{ "time": 1.4666, "x": 0.74, "y": 88.53 }
],
"scale": [
{ "time": 0.8666, "x": 1, "y": 1 },
{ "time": 1.0333, "x": 1.691, "y": 1.759 },
{ "time": 1.1666, "x": 1, "y": 1 },
{ "time": 1.3333, "x": 1.691, "y": 1.759 },
{ "time": 1.4666, "x": 1, "y": 1 }
]
},
"FX3": {
"scale": [
{ "time": 0, "x": 1, "y": 1 },
{ "time": 0.3666, "x": 1.044, "y": 0.947 },
{ "time": 0.6666, "x": 1, "y": 1 },
{ "time": 0.8, "x": 0.962, "y": 1.438 },
{ "time": 0.8666, "x": 0.98, "y": 1.363 },
{ "time": 1, "x": 0.962, "y": 1.438 },
{ "time": 1.0666, "x": 0.98, "y": 1.363 },
{ "time": 1.2, "x": 0.962, "y": 1.438 },
{ "time": 1.2666, "x": 0.98, "y": 1.363 },
{ "time": 1.4, "x": 0.962, "y": 1.438 },
{ "time": 1.5, "x": 0.98, "y": 1.363 },
{ "time": 1.6666, "x": 1, "y": 1 }
]
},
"HEAD": {
"rotate": [
{ "time": 0.7333, "angle": 0 },
{ "time": 0.8, "angle": -11.64, "curve": "stepped" },
{ "time": 1.3333, "angle": -11.64 },
{ "time": 1.6333, "angle": 0 }
]
},
"FX1": {
"translate": [
{ "time": 0.8666, "x": 8.92, "y": 51.33 }
],
"scale": [
{ "time": 0.1333, "x": 1, "y": 1 },
{ "time": 0.3, "x": 1.104, "y": 1.037 },
{ "time": 0.3666, "x": 1, "y": 1 },
{ "time": 0.5333, "x": 1.104, "y": 1.037 },
{ "time": 0.8666, "x": 1, "y": 1 },
{ "time": 1.0333, "x": 1.104, "y": 1.037 },
{ "time": 1.1, "x": 1, "y": 1 },
{ "time": 1.3, "x": 1.104, "y": 1.037 }
],
"flipX": [
{ "time": 0.3666, "x": true },
{ "time": 0.8666 },
{ "time": 0.9666, "x": true },
{ "time": 1.1, "x": true },
{ "time": 1.1666 },
{ "time": 1.2 },
{ "time": 1.3, "x": true }
]
}
},
"drawOrder": [
{
"time": 0,
"offsets": [
{ "slot": "head2", "offset": -6 },
{ "slot": "rwing", "offset": -6 },
{ "slot": "lwing", "offset": -6 },
{ "slot": "head1", "offset": 1 }
]
},
{
"time": 0.1333,
"offsets": [
{ "slot": "head2", "offset": -6 },
{ "slot": "rwing", "offset": -6 },
{ "slot": "lwing", "offset": -6 }
]
},
{
"time": 1.4333,
"offsets": [
{ "slot": "head2", "offset": -6 },
{ "slot": "rwing", "offset": -6 },
{ "slot": "lwing", "offset": -6 },
{ "slot": "head1", "offset": 1 }
]
},
{
"time": 1.5333,
"offsets": [
{ "slot": "head2", "offset": -6 },
{ "slot": "rwing", "offset": -6 },
{ "slot": "lwing", "offset": -6 }
]
},
{
"time": 1.6,
"offsets": [
{ "slot": "head2", "offset": -6 },
{ "slot": "rwing", "offset": -6 },
{ "slot": "lwing", "offset": -6 },
{ "slot": "head1", "offset": 1 }
]
}
]
},
"idle": {
"slots": {
"eye1": {
"color": [
{ "time": 3.3333, "color": "ffffff00" }
]
},
"fx2": {
"color": [
{ "time": 0, "color": "ffffff00" }
]
},
"fx3": {
"color": [
{ "time": 0, "color": "ffffffff" },
{ "time": 0.8333, "color": "ff4046ec" },
{ "time": 1.6666, "color": "ffffffff" },
{ "time": 2.5, "color": "ff5459e3" },
{ "time": 3.3333, "color": "ffffffff" }
]
},
"fx4": {
"color": [
{ "time": 0, "color": "ffffff00", "curve": "stepped" },
{ "time": 0.1666, "color": "ffffff00" },
{ "time": 0.2666, "color": "ffffffff" },
{ "time": 0.4, "color": "ffffff00", "curve": "stepped" },
{ "time": 0.6666, "color": "ffffff00" },
{ "time": 0.7666, "color": "ffffffff" },
{ "time": 0.9, "color": "ffffff00", "curve": "stepped" },
{ "time": 1, "color": "ffffff00" },
{ "time": 1.1, "color": "ffffffff" },
{ "time": 1.2333, "color": "ffffff00", "curve": "stepped" },
{ "time": 1.3666, "color": "ffffff00" },
{ "time": 1.4666, "color": "ffffffff" },
{ "time": 1.6, "color": "ffffff00" }
]
}
},
"bones": {
"WING L": {
"rotate": [
{ "time": 0, "angle": -20.59 },
{ "time": 0.8333, "angle": 16.58 },
{ "time": 1.6666, "angle": -19.28 },
{ "time": 2.5, "angle": 16.58 },
{ "time": 3.3333, "angle": -19.28 }
],
"scale": [
{ "time": 0, "x": 1.214, "y": 1 },
{ "time": 0.8333, "x": 0.753, "y": 1.08 },
{ "time": 1.6666, "x": 1.208, "y": 1 },
{ "time": 2.5, "x": 0.753, "y": 1.08 },
{ "time": 3.3333, "x": 1.208, "y": 1 }
]
},
"WING R": {
"rotate": [
{ "time": 0, "angle": 14.69 },
{ "time": 0.8333, "angle": -8.78 },
{ "time": 1.6666, "angle": 15.4 },
{ "time": 2.5, "angle": -8.78 },
{ "time": 3.3333, "angle": 15.4 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1 },
{ "time": 0.8333, "x": 0.743, "y": 0.961 },
{ "time": 1.6666, "x": 1, "y": 1 },
{ "time": 2.5, "x": 0.743, "y": 0.961 },
{ "time": 3.3333, "x": 1, "y": 1 }
]
},
"HIP": {
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{ "time": 0.8333, "x": 0, "y": -5.72 },
{ "time": 1.6666, "x": 0, "y": 0 },
{ "time": 2.5, "x": 0, "y": -5.72 },
{ "time": 3.3333, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1 },
{ "time": 0.8333, "x": 0.974, "y": 0.98 },
{ "time": 1.6666, "x": 1, "y": 1 },
{ "time": 2.5, "x": 0.974, "y": 0.98 },
{ "time": 3.3333, "x": 1, "y": 1 }
]
},
"FX3": {
"scale": [
{ "time": 0, "x": 1, "y": 1 },
{ "time": 1.6666, "x": 1.091, "y": 0.946 },
{ "time": 3.3333, "x": 1, "y": 1 }
]
},
"FX1": {
"translate": [
{ "time": 0.1666, "x": 0, "y": 0 },
{ "time": 0.4, "x": 2.23, "y": 5.2 },
{ "time": 0.6666, "x": 0, "y": 0 },
{ "time": 0.9, "x": 14.88, "y": 4.46 },
{ "time": 1, "x": 0, "y": 0 },
{ "time": 1.2333, "x": 2.23, "y": 5.2 },
{ "time": 1.3666, "x": 0, "y": 0 },
{ "time": 1.6, "x": 14.88, "y": 4.46 }
],
"scale": [
{ "time": 0.1666, "x": 1, "y": 1 },
{ "time": 0.4, "x": 1.171, "y": 1.276 },
{ "time": 0.6666, "x": 1, "y": 1 },
{ "time": 0.9, "x": 1.205, "y": 1.276 },
{ "time": 1, "x": 1, "y": 1 },
{ "time": 1.2333, "x": 1.171, "y": 1.276 },
{ "time": 1.3666, "x": 1, "y": 1 },
{ "time": 1.6, "x": 1.171, "y": 1.276 }
],
"flipX": [
{ "time": 0.6666, "x": true },
{ "time": 1 },
{ "time": 1.3666, "x": true }
]
}
},
"drawOrder": [
{
"time": 0,
"offsets": [
{ "slot": "head1", "offset": 1 }
]
},
{ "time": 0.3333 },
{
"time": 0.4,
"offsets": [
{ "slot": "head1", "offset": 1 }
]
},
{ "time": 1.2333 },
{
"time": 1.3,
"offsets": [
{ "slot": "head1", "offset": 1 }
]
},
{ "time": 1.5333 },
{
"time": 1.6,
"offsets": [
{ "slot": "head1", "offset": 1 }
]
}
]
}
}
}
003.png
HelloWorldScene.h
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
class HelloWorld : public cocos2d::Layer
{
public:
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* createScene();
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// a selector callback
void menuCloseCallback(cocos2d::Ref* pSender);
// implement the "static create()" method manually
CREATE_FUNC(HelloWorld);
};
#endif // __HELLOWORLD_SCENE_H__
HelloWorldScene.cpp
#include "HelloWorldScene.h"
#include <spine/spine.h>
#include <spine/SkeletonAnimation.h>
USING_NS_CC;
Scene* HelloWorld::createScene(){
auto scene = Scene::create();
auto layer = HelloWorld::create();
scene->addChild(layer);
return scene;
}
bool HelloWorld::init(){
if(!Layer::init()){
return false;
}
auto spine = spine::SkeletonAnimation::createWithFile("003.json", "003.atlas",1);
this->addChild(spine);
spine->setPosition(Point(200,10));
spine->addAnimation(0,"atk",false);
return true;
}
note:it seems not crash when comment out spine->addAnimation(0,"atk",false);
then created a new project of cocos2d-x 3.4, put 003.atlas, 003.json ,003.png into Resources, put HelloWorldScene.h and HelloWorldScene.cpp into Classes,
when all files put into Xcode and run with iPhone simulator, AT FIRST TIME RUN it seems not crashed but shows nothing (then I found I the position I set at first is out of screen, now corrected as (200,10), but I quite sure that it does not crash when first time run):
AT SECOND TIME RUN it crashes with EXEC_BAD_ACCESS:
mac version:10.10.2
cocos2d-x version: 3.4
xcode version:6.2
spine version: Spine Essential
platform:iphone 5 simulator/ios 8.2
what is the problem???
project structure:
files that used:
amuse.zip
Try spine->setAnimation(0,"atk",false);
instead of addAnimation
, though this shouldn't hurt. Inspect the SkeletonAnimation instance. What is _skeleton
? _skeleton->data
? When you call setAnimation, what is self
? self->animations
? Do you use spine-cocos2dx from GitHub?
what is "spine-cocos2dx from GitHub"?
I then download cocos2d-x 3.4 again and find there is some spine code in cocos2d/cocos/editor-support/spine in the project file created by cocos2d-x, then I download spine-runtimes-master and then copy all files in spine-c/include/spine, spine-c/src/spine and spine-cocos2dx/3/src/spine to replace file in cocos2d/cocos/editor-support/spine in project, it seems work, is it the correct step?
but now the animation seems run normal except there is a problem : the character should have blink animation during "idle" and "atk" action (you may call spine->setAnimation(0,"idle",false); to test),but now the character always close eyes
you can see in 003.png the original face is open eye, blink was done by masking face by image "eye1" and then set opacity to emulate blink action (you can see "eye1" in 003.json),but now it seems "eye1" always on the character face without changing opacity:
what is the problem?