i'm developing a 2d top down shooter and i implemented collisions using rects, and everytime something moves i test collisions with all the other rects.
The problem raised now that i have to add bullets to my game, my first approach was to get the points of the line of the bullet and test collision with every rect for every point of the line, but this is the worst implementation that i ever used.
What's the best approach for the bullet physic?
You might want to look at line/line intersection tests, (check the line the bullet is making against each line of the bounding rectangle for the possible target objects)
Then remember these simple facts:
1) The fastest code you can write is code that isn't executed
2) Objects that are far from eachother will not touch eachother
3) circle/circle collision tests or AABB tests are faster than line/line test. (and thus it makes sense to perform a quick rough test using one of these before you do a more expensive and accurate test)
4) If you partition your objects based on their location (using for example a tree structure) you can avoid testing colissions against objects that are far away very easily.
I don't suffer from insanity, I'm enjoying every minute of it. The voices in my head may not be real, but they have some good ideas!