My own spriteAnimation Class not working

My own spriteAnimation Class not working
0.0 0


hello everyone,
I am trying to create my own Prototype class in generating basic animation

#include "cocos2d.h"

using namespace cocos2d;

spriteObject::spriteObject(const char* spriteFile, float x, float y)
    sprite = CCSprite::spriteWithFile(spriteFile);

class spriteAnimateMovementDirection : public CCLayer
    CCRepeatForever* repeat;
    //spriteAnimateMovementDirection(const char* spriteFile, ...);
    spriteAnimateMovementDirection(const char* sprite1, const char* sprite2);

    CCMutableArray* animationFrames;
    CCMutableArray* spriteAnimationFiles;


spriteAnimateMovementDirection::spriteAnimateMovementDirection(const char* sprite1, const char* sprite2)
    CCTexture2D* texture;
    CCRect textureRect;
    CCSpriteFrame* spriteFrame;
    CCAnimate* animate;
    CCAnimation* animation;

    texture = CCTextureCache::sharedTextureCache()->addImage(sprite1);
    textureRect = CCRectMake(0, 0, texture->getContentSize().width, texture->getContentSize().height);
    spriteFrame = CCSpriteFrame::frameWithTexture(texture,textureRect);

    texture = CCTextureCache::sharedTextureCache()->addImage(sprite2);
    textureRect = CCRectMake(0, 0, texture->getContentSize().width, texture->getContentSize().height);
    spriteFrame = CCSpriteFrame::frameWithTexture(texture, textureRect);

    animation = CCAnimation::animationWithFrames(animationFrames,0.2f);
    animate = CCAnimate::actionWithAnimation(animation);
    repeat = CCRepeatForever::actionWithAction(animate);

so on the helloworldscene.cpp

#include "HelloWorldScene.h"
#include "MyClass.h"
using namespace cocos2d;

spriteObject* hero;

CCScene* HelloWorld::scene()
    CCScene * scene = NULL;
        // 'scene' is an autorelease object
        scene = CCScene::node();
        CC_BREAK_IF(! scene);

        // 'layer' is an autorelease object
        HelloWorld *layer = HelloWorld::node();
        CC_BREAK_IF(! layer);

        // add layer as a child to scene
    } while (0);
    // return the scene
    return scene;

// on "init" you need to initialize your instance
bool HelloWorld::init()
    spriteObject hero("heroDownStand.png",100,100);
    spriteAnimateMovementDirection moveUp("heroDownWalk1.png", "heroDownWalk2.png");
    return true;

void HelloWorld::menuCloseCallback(CCObject* pSender)
    // "close" menu item clicked

after compiling the simulator doesn’t show up but there where no error on the compilation.


anyway I already figured it out, it turns out my CCSpriteFrame was not initialized.\