線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2269
推到 Plurk!
推到 Facebook!

如何解决2D平面游戏中的碰撞问题

尚未結案
zw
一般會員


發表:21
回覆:25
積分:9
註冊:2003-04-28

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-04-28 13:39:55 IP:61.176.xxx.xxx 未訂閱
例如子弹打飞机的程序,怎样判断子弹是否打中飞机(子弹进入飞机所在的区域),最好给出原代码。 请给位指教。
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-04-28 14:56:36 IP:147.8.xxx.xxx 未訂閱
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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-04-28 16:29:06 IP:61.176.xxx.xxx 未訂閱
引言: 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

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-04-28 16:30:07 IP:61.176.xxx.xxx 未訂閱
引言: 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

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-04-28 16:41:44 IP:61.176.xxx.xxx 未訂閱
本人知道可以用 Rect()函数 PtinRect()函数 来实现,但具体参数如何给(image的两个顶点,和目标区域的给定点的参数值) 我还没搞明白
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-04-29 00:18:18 IP:210.0.xxx.xxx 未訂閱
引言:本人知道可以用 Rect()函数 PtinRect()函数 来实现,但具体参数如何给(image的两个顶点,和目标区域的给定点的参数值) 我还没搞明白
這回到我糊塗了,Sprites 應是你用程式秀出來的吧,它的區域(bounding recentangle)你應該一早便掌握了 在子彈打飛機類的游戲上,我想簡單的區域碰撞測試應可滿足要求, < href="http://www.gamedev.net/reference/articles/article735.asp">http://www.gamedev.net/reference/articles/article735.asp
系統時間:2024-04-27 6:11:13
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!