View Single Post
Old 03 June 2018, 17:41   #5
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
Quote:
Originally Posted by E-Penguin View Post

I wonder whether some sort of binary search would speed it up, at the cost of maintaining the enemy list in a sorted order?
If all enemies can be at any X or Y without actually have one side of the screen more used than the other, I have the feeling that the time you will take sorting it will not compensate for what you may gain with a binary search.


I was thinking about trying to use some kind of grid structure... my screen is 320x256. I divide this maybe ine 10x8 32 pixels cells. Bullet check collisions only against enemies on the surrounding cells it is right now. But I just can't wrap my mind on how to make something like this work anyway.
Shatterhand is offline  
 
Page generated in 0.04337 seconds with 11 queries