0
使用下面的代碼,我可以連續更改我的CCSprite的顏色,但是我需要用此代碼更改我的CCSprite圖像。我怎樣才能做到這一點?連續切換精靈圖像(不顯示動畫)
注意:不希望只顯示框架更改的動畫,我需要選擇稍後在代碼中不斷更改的其中一個精靈。
id delayTime1 = [CCDelayTime actionWithDuration:0.05f];
id calFun1 = [CCCallBlock actionWithBlock:^{
//HERE SET BLUE TEXTURE..
// m_spriteBubbleWeapon= [CCSprite spriteWithFile:[NSString stringWithFormat:@"firstimage.png"]];// //kill when i uncomment it
m_spriteBubbleWeapon.color = ccc3(255,0,255); // works current
}];
id delayTime2 = [CCDelayTime actionWithDuration:0.05f];
id calFun2 = [CCCallBlock actionWithBlock:^{
//HERE SET RED TEXTURE..
//m_spriteBubbleWeapon= [CCSprite spriteWithFile:[NSString stringWithFormat:@"second image.png"]];//kill when i uncomment it
m_spriteBubbleWeapon.color = ccc3(255,0,0);//work correct
}];
id sequece = [CCSequence actions:delayTime1, calFun1, delayTime2, calFun2, nil];
id repeate = [CCRepeatForever actionWithAction:sequece];
[sprite runAction:repeate];
@iphonemaclover編輯我的答案 – jyek 2013-04-09 05:19:26