Skip to content

Animation runs slowly on a sprite despite setting CCAnimation object's setDelayperUnit to lowest value #27

@saudahmed

Description

@saudahmed

Bug: I have created a simple coin animation that executes perfectly but the delay between the frames remains the same whether I have set the delayPerUnit. Infact the delay is quite low and the frames changed very slowly. Here is my sample code that I have tried with and without CCSpriteBatchNode the results are the same.

CCSize size = CCDirector::sharedDirector()->getWinSize();

CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("coin-sprite-sheet.plist");

CCSpriteBatchNode * batchNode = CCSpriteBatchNode::create("coin-sprite-sheet.png");

this->addChild(batchNode);

CCArray * spriteFrames = CCArray::create(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("coin-1.png"),
CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("coin-2.png"),
CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("coin-3.png"),
CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("coin-4.png"),
NULL);

CCAnimation* animation = CCAnimation::createWithSpriteFrames(spriteFrames);
animation->setDelayPerUnit(0.6); <---- change here to any value no effect

CCSprite * sprite_ = CCSprite::createWithSpriteFrameName("coin-1.png");
sprite_->setPosition(ccp(size.width/2,size.height/2));

batchNode->addChild(sprite_, 10);

CCRepeatForever * rep = CCRepeatForever::create(CCAnimate::create(animation, true));
sprite_->runAction(rep);

I believe it's a bug in cocos2dx-WindowsPhone. And on cocos2dx-Windows ccanimate action never runs and crashes. I am using currently this http://github.com/qima/cocos2d-windowsphone and also cocos2d-Windows for api 2.1. Please have you added a fix for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions