I'm thinking at how i should manage collisione in my game. I'm thinking about having a "Collision" class that checks for collision, and in case takes actions to resolve them.
My problem is the sequent:
A and B moving to the other, when they collide they must bounce.
If I resolve the collisions sequentially, like calling: A.collideWith(B), B.collides With(A) B will be stuck, because A has already updated his velocity and position, and when will be called B.collideWith(A) there won't be collision anymore.
So, It is a good idea to use a double buffer pattern?
I'll write the values obtained by the collision resolver in some variables, they will be swapped to the real ones when all the collision has been resolved. It that way all should works fine. But it is a good software design?
Sorry for my english, Thanks to all!