Jump to content

xiemakeinu

Members
  • Posts

    3
  • Joined

  • Last visited

Reputation Activity

  1. Like
    xiemakeinu got a reaction from UElabeal in Cocos2d-x 2.2.2 Spriter Implementation   
    Hello all. I wanted to implement Spriter into Cocos2d-x 2.2.2, so I scoured these forums and the internet, but wasn't too happy with the results. Generic C++ implementations and old Cocos2d-x implementations that weren't really set up to do things the "Cocos2d-x" way, meaning they weren't fully utilizing the CCNode hierarchy for transforms. I'm still working on this thing, but I wanted to go ahead and share it in its current state. Simple sprite and bone animations are functional: translation, rotation, scale, and colorizing.
    Please note that some of the files in the attached archive need to be merged into the existing engine code. Also, for some reason unbeknownst to me, Cocos2d-x is set up to use reversed rotations(positive being clockwise), which I decided to change at the core level of the engine. Obviously this could break a lot of the built in tools, so some of you may want to just inverse the rotations in the Spriter implementation instead.
    You can use this implementation like you do anything else in Cocos2d-x:

    CCSpriter* spriterTest = CCSpriter::create("anim/player/Player.scml");
    spriterTest->setPosition(CCPointMake(512.0f, 384.0f));
    addChild(spriterTest, 5);
    My future plans for this are:

    [*:1jditbpz]Add support for zindex
    [*:1jditbpz]Add support for parent swapping
    [*:1jditbpz]Add support for texture swaps(may already work, needs testing)
    [*:1jditbpz]Add support for default file defined pivots
    [*:1jditbpz]Add support for adding/removing sprites and bones during animation
    [*:1jditbpz]Add support for plists
    Not sure how much further I'm going to go with it beyond that, but this should lay a good groundwork for someone to make it "fully featured". Because this is loosely based on work done by BruceWang and 568083142 on this forum, which was based on work done by James Hui (a.k.a. Dr.Watson), I've stuck with the BSD License.
    CCSpriter.zip
×
×
  • Create New...