0
votes

I am trying to make sprite sheet animation work with another Action. For this purpose i've a Sprite sheet .png file without any .plist file. My problem is that the spritesheet animation works but with other action like this one in following code block it just doesn't. It will first move it to the destination and then animates it but all i want it to move while animating itself.

void animatespritesheet()
{
     for(i=0;i<10;i++)
         {

            _spriteFrame=CCSpriteFrame::create("bulb_f.png",CCRectMake(i*75,0,75,75));

            _anims->addObject(_spriteFrame);
         }

    _animation=CCAnimation::createWithSpriteFrames(_anims,1.0f);

    CCSprite* sprite = CCSprite::createWithSpriteFrame(_spriteFrame);
    //sprite->setPosition(ccp(256,256));

    CCAction* axn = CCRepeatForever::create(CCAnimate::create(_animation));
    /*CCAction *axn1 = CCMoveTo::create(1.0f,CCPoint(200,200));
    CCMoveTo* move = CCMoveTo::create(1.0f,CCPoint(200.0,200.0));*/
    _spriteBatch->addChild(sprite);
    sprite->runAction(axn);
    //sprite->runAction(move);
    //sprite->runAction(CCSequence::Create(move,axn,NULL);
   }

_anims is a CCArray. the png file is 75*750 file which contains 10 frames. I just can't get this thing done by myself. Please Help me out on this. I Really need help on it.

1

1 Answers

1
votes

Use a CCSpawn to run both actions at the same time (this examples assumes cocos 3.0).

[CCActionSpawn actions:action1, action2, nil];