Original Post
Say I have a collision detection function that takes the coordinates on screen of the top left corner and the bottom right corner of two sprites to determine if a collision has occured between them. Now lets say I have a screen with numerous sprites of trees located in various locations on the screen and there is also a sprite of the player. It would be quite inefficient for my code to test if a collision has occured between each of the trees and the player each time the player moves. How would I code a solution to this problem in a more efficient manner?