i was once working on some game code that had developed organically, so there was a weird mix of various sprite operations being done in either the world or the sprite's coordinate system. someone wanted to add sprite transformations like mirroring (basically the ability for a sprite to turn into its reflection sprite along one of its axes) and scaling, but there were several places where there would need to be checks for e.g. "if sprite.x_mirrored" and "if sprite.y_mirrored" when dealing with other transformations like off-centre rotations, and no one was eager to sit and go through them all.
so i took some time and consolidated all the sprite geometry code into a bounding box object, and then had every sprite own a bounding box, and have the rest of the code interact with the bounding box where possible. that suddenly made a bunch of other things easier to do, because they came down to "how will this affect the bounding box" and they could be done in a single place.
so i took some time and consolidated all the sprite geometry code into a bounding box object, and then had every sprite own a bounding box, and have the rest of the code interact with the bounding box where possible. that suddenly made a bunch of other things easier to do, because they came down to "how will this affect the bounding box" and they could be done in a single place.