→ Esvent:之前好像遇過同樣的問題... 12/02 20:08
→ Esvent:CCMenu的itemForTouch方法 把CGPoint touchLocation那行改 12/02 20:13
→ Esvent:成CGPoint touchLocation = [touch locationInView: 12/02 20:14
→ Esvent: [CCDirector sharedDirector].view]; 試試看 12/02 20:14
→ Esvent:p.s.記憶久遠 錯了別打我XD 12/02 20:16
謝謝您,不過不好意思我沒有講清楚
這玩意他不是用item
其實是他用cctouches 然後去看點到的坐標有沒有跟sprite重疊
有的話就觸發點擊,而就是cctouches取出來的點出事了
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch=[touches anyObject];
CGPoint locationOrig=[touch locationInView:[touch view]];
CGPoint location = [[CCDirector sharedDirector] convertToGL:locationOrig];
}
最後那行convert跟沒有一樣
我有想要把它改成CCMENU
但這是公司的舊專案要維護,之前寫的人不知道跑哪去了
這東西又寫得亂七八糟 還有真扭假按鈕的...然後一堆delegate 又沒有注解..
所以看來應該是只能從抓點下手...
請問有高人能指點嗎O.Q
※ 編輯: santaclub 來自: 112.209.134.72 (12/02 21:43)
→ Esvent:試試把locationOrig換成我貼的那行看看? 他們的Code感覺是 12/02 21:53
→ Esvent:在做同樣一件事 12/02 21:53
→ santaclub:可是 [CCDirector sharedDirector] 沒有.view 12/02 22:06
→ santaclub:可是有openGLView,直接把你的拿來就可以動了 12/02 22:13
→ santaclub:不用再次轉換,太感謝您了!!! 12/02 22:14