View Single Post
Old 03 June 2018, 19:17   #6
Dan
Registered User
 
Dan's Avatar
 
Join Date: Nov 2004
Location: Germany
Posts: 629
well, then each bullet shall have grid position coordinates px,py

The enemy ship has, as well, px,py Grid - coordinates.


So when you save the coordinates for each bullet, you check if bullets px/py coordinate are near ship px,py , something like pseudo code:
Code:
if abs(bulletPX(x)-EShip_px(x))<=2 and Abs(BulletPY(y)-EShip_Py(x))<=2 then 
check for colision
endif
you should see what works better <=2 or <=1 , depending on the grid size.

Last edited by Dan; 03 June 2018 at 19:26.
Dan is offline  
 
Page generated in 0.04268 seconds with 11 queries