-1
我在用Cocos2D製作一個簡單的遊戲。用戶可以觸摸並追蹤小移動物體的路徑。對象然後遵循路徑。這與飛行控制遊戲機制相似。用Cocos2D爲iPhone繪製曲線
我該如何移動這樣的對象,請幫助我解決這個問題。任何示例代碼或教程將幫助我更多的感謝你。
我在用Cocos2D製作一個簡單的遊戲。用戶可以觸摸並追蹤小移動物體的路徑。對象然後遵循路徑。這與飛行控制遊戲機制相似。用Cocos2D爲iPhone繪製曲線
我該如何移動這樣的對象,請幫助我解決這個問題。任何示例代碼或教程將幫助我更多的感謝你。
在你touchesEnded/touchesMoved方法試着這樣做:
UITouch *touch = [touches anyObject];
if (touch) {
CGPoint location = [touch locationInView:[touch view]];
CGPoint convertedPoint = [[CCDirector sharedDirector] convertToGL:location];
id animation = [CCMoveTo actionWithDuration:0.1 position:convertedPoint];
[playerShip runAction:animation];
}