In the first loop you clear the velocity change when you first encounter a sprite, but it may have already been in a collision by that point.
For example if the first rectangle hits the second, the second will receive a velocity change, which will be cleared before it is applied.
You may also need to run through the whole list multiple times to resolve all intersections.
Show differencesHistory of post edits
#1EWClay
Posted 04 February 2013 - 11:57 AM
In the first loop you clear the velocity change when you first encounter a sprite, but it may have already been on a collision by that point.
For example if the first rectangle hits the second, the second will receive a velocity change, which will be cleared before it is applied.
You may also need to run through the whole list multiple times to resolve all intersections.
For example if the first rectangle hits the second, the second will receive a velocity change, which will be cleared before it is applied.
You may also need to run through the whole list multiple times to resolve all intersections.