我需要將UIKit圖層的位置與Cocos2D場景圖層同步,發生過渡,將當前場景從新屏幕移出屏幕。我編輯了CCActionEase來創建我自己的更新方法,它可能會在我的委託中調用一個方法來發送我的Cocos2D場景圖層的當前位置。我只需要一種方式來獲取CCActionEase中場景的當前位置。它需要在這裏,因爲CCActionEase一遍又一遍地調用更新,而現在,場景的位置正在改變。Cocos2d:在CCActionEase中獲取場景的當前位置
這是我的代碼運行順序的東西被稱爲。
在我的場景當前圖層我過渡的方法被稱爲:
[[CCDirector sharedDirector] replaceScene: [ExitUTransition transitionWithDuration:5.4 scene: [JoinedMapsScene scene]]];
那堂課我的自定義CCEaseInWithPercentMult的actionWithAction被稱爲:
@implementation ExitUTransition
- (CCActionInterval*)easeActionWithAction:(CCActionInterval*)action {
return [CCEaseInWithPercentMult actionWithAction:action rate:1.0f];
}
@end
在CCActionEase,更新方法被調用:
@implementation CCEaseInWithPercentMult
-(void) update: (ccTime) t
{
[other update: powf(t,rate)];
//here I could pass the scene layer position
[(cocosTestsAppDelegate *)[[UIApplication sharedApplication] delegate] adjustBGViewPosWithXOffset:scenePosX withYOffset:scenePosY];
}
@end
這看起來像是一個移動UIKit東西的非常酷的方法,但是我仍然可以在我使用CCActionEase這樣的場景轉換的情況下使用它嗎? – VagueExplanation