如何解决2D平面游戏中的碰撞问题 |
尚未結案
|
zw
一般會員 發表:21 回覆:25 積分:9 註冊:2003-04-28 發送簡訊給我 |
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
A fast and simple way for doing collision detection is using the bounding rectangles of the spriates and test whehter they are overlapped or not. If you don't want to write your own function, you may be interested in the IntersectRect API. If you want to do a pixel perfect collision detection, I think you would better create masked mono bitmaps for all your spriates and use the masks for collision detecton.
|
zw
一般會員 發表:21 回覆:25 積分:9 註冊:2003-04-28 發送簡訊給我 |
引言: A fast and simple way for doing collision detection is using the bounding rectangles of the spriates and test whehter they are overlapped or not. If you don't want to write your own function, you may be interested in the IntersectRect API. If you want to do a pixel perfect collision detection, I think you would better create masked mono bitmaps for all your spriates and use the masks for collision detecton.感谢你的回答,不过不是太详细,我知道原理,问题是具体的实现方法,最好给出代码参考,还有希望用中文交流。这个问题本人仍没解决,希望有心人多多指教。 |
zw
一般會員 發表:21 回覆:25 積分:9 註冊:2003-04-28 發送簡訊給我 |
引言: A fast and simple way for doing collision detection is using the bounding rectangles of the spriates and test whehter they are overlapped or not. If you don't want to write your own function, you may be interested in the IntersectRect API. If you want to do a pixel perfect collision detection, I think you would better create masked mono bitmaps for all your spriates and use the masks for collision detecton.感谢你的回答,不过不是太详细,我知道原理,问题是具体的实现方法,最好给出代码参考,还有希望用中文交流。这个问题本人仍没解决,希望有心人多多指教。 |
zw
一般會員 發表:21 回覆:25 積分:9 註冊:2003-04-28 發送簡訊給我 |
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
引言:本人知道可以用 Rect()函数 PtinRect()函数 来实现,但具体参数如何给(image的两个顶点,和目标区域的给定点的参数值) 我还没搞明白這回到我糊塗了,Sprites 應是你用程式秀出來的吧,它的區域(bounding recentangle)你應該一早便掌握了 在子彈打飛機類的游戲上,我想簡單的區域碰撞測試應可滿足要求, < href="http://www.gamedev.net/reference/articles/article735.asp">http://www.gamedev.net/reference/articles/article735.asp |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |