2013-03-18 32 views
1
blue = [CCMenuItemImage itemFromNormalImage:@"blue.png" selectedImage:@"blueclick.png"]; 
    [blue setPosition:ccp(175, 350)]; 
    blue.scale = .75; 
    [self addChild:blue z: 5]; 



id move = [CCMoveBy actionWithDuration:1.0f position:CGPointMake(334, 321.75)]; 
    [blue runAction:move]; 

當我點擊它時,爲什麼它不會更改爲第二個圖像(blueclick.png)?此外,我會如何推遲這個功能?如何使點擊工作以及如何在init中延遲函數? XCODE

+0

找不到關係的Xcode。刪除標籤。 – 2013-03-18 22:15:46

+0

當您單擊並按住菜單項時,圖像發生變化,而不是單擊它時/之後。要延遲操作,請使用CCDelay操作和一個序列。 – LearnCocos2D 2013-03-19 00:58:42

回答

0

試試這個代碼與延遲運行動作:

 id delay = [CCDelayTime actionWithDuration:delay]; 
     id move  = [CCMoveTo actionWithDuration:0.4 position:ccp(x, y)]; 
     id sequence = [CCSequence actions:delay, move, nil]; 
     [card.sprite runAction:sequence];