0
現在,我確實喜歡這樣。 12個動畫同時移動。Cocos2d-x我不知道如何給動畫延遲
(對不起,我不能上傳圖像,這樣,我做到了。|〜|是一條線,這是3×4矩陣)
| 1 1 1 |
| 1 1 1 |
| 1 1 1 |
| 1 1 1 |
不過,我想是這樣的。
EX)有12個潘內爾FOWARD順序左上角1,2,3,...,12
所以,動畫移動1,2,3個週期的時間,而不是同時。
| 1 2 3 |
//像這樣。
我沒有搜索互聯網並添加了一些。但是,我無法移動它。我該怎麼做。
這是我的代碼。
CCSprite* maker_sh = CCSprite::create("img/marker_sh.jpg") ;
CCAnimation* sh_ani = CCAnimation::create() ;
sh_ani -> setDelayPerUnit(0.05) ;
for(int i = 0 ; i < 24 ; i++)
{
int index = i % 5 ;
int rowIndex = i/5 ;
sh_ani -> addSpriteFrameWithTexture(maker_sh -> getTexture(), CCRectMake(index * 120, rowIndex * 120, 120, 120)) ;
}
CCAnimate* animate[12] ;
CCAction* rep[12] ;
for(int i = 0 ; i < 12 ; i++)
{
animate[i] = CCAnimate::create(sh_ani) ;
rep[i] = CCRepeatForever::create(animate[i]) ;
}
int cnt = 0 ;
CCSprite* test[12] ;
for(int i = 3 ; i > -1 ; i--)
for(int j = 0 ; j < 3 ; j++)
{
cnt++ ;
test[j + (3 - i) * 3] = CCSprite::createWithTexture(maker_sh -> getTexture(), CCRectMake(0, 0, 120, 120)) ;
test[j + (3 - i) * 3] -> setPosition(ccp(j * 125 + 120, i*125 + 75)) ;
this -> addChild(test[j + (3 - i) * 3]) ;
test[j + (3 - i) * 3] -> runAction(rep[j + (3 - i) * 3]) ;
CCLog("%d", cnt) ;
}
TNX,我知道了:d – user2352907 2013-05-07 05:32:00
@ user2352907 :) – PeakCoder 2013-05-07 06:20:34