Ray wenderlich fruit ninja translation

Hello,

I’m trying to translate the cocos2d ray wenderlich fruit ninja tutorial for cocos2d-x.

http://www.raywenderlich.com/14393/how-to-make-a-game-like-fruit-ninja-with-box2d-and-cocos2d-part-2

But I have a problem when I slice an object.

When a sprite is cut, 2 sprites are created, one of those is good but the other has no texture.
Moreover if I try to cut again this sprite, the app crash.

Any Ideas ?

find enclosed the classes source code,
or you can get the project on github : https://github.com/jord14k/Cut-the-bomb.

Thanks.


FNClasses.zip (23.5 KB)

I’ve tested it here and found some things that you’ve forgotten:

GameScene.cpp

@408
this->addChild(newSprite1);

@461
bool GameScene::areVerticesAcceptable(b2Vec2* vertices, int count) {
    if(count >= 3 && count <= b2_maxPolygonVertices)
        return true;
    return false;
}

Thank you very much, it works.

I’ll continue the translation when I have the time. I’ll come back to you for sharing.