I am trying to run the example for cocos2d-iphone using version 3
I created a directory named cocos2d where I put the cocos2d v3 distribution. I am getting errors of "cocos2d.h not found", "spine/spine.h" not found, when I open the example iOS project in Xcode
I am using SpriteBuilder which is a great product, not sure if you have a special example for that, but getting the cocos2d-iphone to work will be fine.
Update: working now . I needed to also add the spine-c folder not just the spine-cococ2d-iphone folder. Very cool
I am looking at the example an am trying got understand the code for example in the SpinebodyExample.m
skeletonNode = [SkeletonAnimation skeletonWithFile:@"spineboy.json" atlasFile:@"spineboy.atlas" scale:0.6];
[skeletonNode setMixFrom:@"walk" to:@"jump" duration:0.2f];
[skeletonNode setMixFrom:@"jump" to:@"run" duration:0.2f];
__weak SkeletonAnimation* node = skeletonNode;
skeletonNode.startListener = ^(int trackIndex) {
spTrackEntry* entry = spAnimationState_getCurrent(node.state, trackIndex);
const char* animationName = (entry && entry->animation) ? entry->animation->name : 0;
NSLog(@"%d start: %s", trackIndex, animationName);
};
skeletonNode.endListener = ^(int trackIndex) {
NSLog(@"%d end", trackIndex);
};
skeletonNode.completeListener = ^(int trackIndex, int loopCount) {
NSLog(@"%d complete: %d", trackIndex, loopCount);
};
skeletonNode.eventListener = ^(int trackIndex, spEvent* event) {
NSLog(@"%d event: %s, %d, %f, %s", trackIndex, event->data->name, event->intValue, event->floatValue, event->stringValue);
};
[skeletonNode setAnimationForTrack:0 name:@"walk" loop:YES];
spTrackEntry* jumpEntry = [skeletonNode addAnimationForTrack:0 name:@"jump" loop:NO afterDelay:3];
[skeletonNode addAnimationForTrack:0 name:@"run" loop:YES afterDelay:0];
[skeletonNode setListenerForEntry:jumpEntry onStart:^(int trackIndex) {
CCLOG(@"jumped!");
}];
===========
For example the spTrackEntry* jumpEntry is created as a block for jump where setAnimation was used for the walk and run. Do you start with a setAnimation then use addAnimations for additional animations to this?
I looked at the Documentation, but am still confused Thanks for any help in understanding the code. Perhaps code comments would be helpful for us newbies