2012-07-25 19 views
0

我想用CCScaleTo來縮放我的精靈。CCScale不適用於sprite

這裏是我的代碼:

CCSprite *spritePauseScreen =[CCSprite spriteWithFile:@"resumeGameScreenBG.png"] ; 
spritePauseScreen.position= ccp(winSize.width/2,winSize.height/2); 
spritePauseScreen.scale=0.5f; 
[spritePauseScreen runAction:[CCScaleTo actionWithDuration:0.6 scaleX:1.0f scaleY:1.0f]]; 
[self addChild:spritePauseScreen z:7]; 

它不工作。精靈僅以0.5的刻度值顯示。它不會被擴大到1.0請幫忙嗎?...

+1

現在我在Cocos2D 2.0示例中使用了相同的代碼,它的工作正常。可能是你的基礎層的問題? – Guru 2012-07-25 05:30:46

+0

真的非常感謝Raj的關注。這是我的不好。我正在使用此動畫彈出暫停屏幕。所以錯誤在於我在做[[CCDirector sharedDirector]暫停];同時由於遊戲引擎停止執行任何操作。 任何方式。 Reali感謝您的幫助。 :) – NiKKi 2012-07-25 05:50:48

+0

你說得對,這太好了。歡迎。 – Guru 2012-07-25 06:00:43

回答

3

試試這個代碼。

int delayTime = 0.3f; 
CCSprite *each = [CCSprite spriteWithFile:@"Icon.png"]; 
each.position = ccp(160,240); 
each.scaleX = 0.0f; 
each.scaleY = 0.0f; 
CCAction *action = [CCSequence actions: 
      [CCDelayTime actionWithDuration: delayTime], 
      [CCScaleTo actionWithDuration:0.5F scale:1.0],nil]; 
delayTime += 0.2f; 
[each runAction: action]; 
[self addChild:each]; 
+0

嗨Femina。 Reali感謝您的關注。你的代碼是正確的。這是我的不好。我正在使用此動畫彈出暫停屏幕。所以錯誤在於我在做[[CCDirector sharedDirector]暫停];同時由於遊戲引擎停止執行任何操作。任何方式。 Reali感謝您的幫助。 :) – NiKKi 2012-07-25 05:52:18

相關問題