求教,鱼没有游动

CCSprite* fish = CCSprite::create();
fish->setPosition(ccp(100,100));
CCAnimation *animation = CCAnimation::create();
CCTexture2D texture = CCTextureCache::sharedTextureCache()->addImage(“fishingjoy_resource.png”);
for(int i=0; i < 5; i++)
{
animation->addSpriteFrameWithTexture(texture, CCRect(450, i
30 + 400, 56, 23));
}
CCAnimate *animate = CCAnimate::create(animation);
fish->setPosition(ccp(200,200));
fish->runAction(CCRepeatForever::create(animate));
this->addChild(fish);

代码是模仿 cocos2d-x捕鱼达人上面的
但是调试的时候,看不见鱼。。。。
texture是加载成功了的。

fish没有加载图片, 可以把CCSprite* fish = CCSprite::create(); 改为CCSprite* fish = CCSprite::create(“fishingjoy_1.png”); //自己从png中读取,
还有,你没有设置动画的间隔时间~~~自己查找一下cocos2d-x看看吧!!

— Begin quote from ____

引用第1楼蜡笔小新爱00于2013-11-19 18:08发表的 :
fish没有加载图片, 可以把CCSprite* fish = CCSprite::create(); 改为CCSprite* fish = CCSprite::create(“fishingjoy_1.png”); //自己从png中读取,
还有,你没有设置动画的间隔时间~~~自己查找一下cocos2d-x看看吧!! http://www.cocoachina.com/bbs/job.php?action=topost&tid=168675&pid=852366

— End quote

3q, 设上动画间隔时间就可以动了。。。。

— Begin quote from ____

引用第1楼蜡笔小新爱00于2013-11-19 18:08发表的 :
fish没有加载图片, 可以把CCSprite* fish = CCSprite::create(); 改为CCSprite* fish = CCSprite::create(“fishingjoy_1.png”); //自己从png中读取,
还有,你没有设置动画的间隔时间~~~自己查找一下cocos2d-x看看吧!! http://www.cocoachina.com/bbs/job.php?action=topost&tid=168675&pid=852366

— End quote

这个论坛不能设置最佳答案么?

animation ->setLoop(-1); 循环执行