Open rkettering opened 10 years ago
I fully agree with this, although I might suggest that a better fix would be to set the rotation point for the clipped object instead of padding it. We already support this iirc, so it could perhaps be able to be included without too much trouble.
We have code that tightens our sprites in memory by shrinking their rectangular area just enough to omit any rows and columns which are composed purely of transparent pixels. This is always active, but one of the intents for this, besides lightening our blitting and video memory load, was to deal with one necessary step in creating texture atlases. I believe the optimization goal (minimizing memory usage at all costs) was a bit too aggressive, in light of the current engine goal of making anura accessible to people interested in game-making, because this breaks object rotation and scaling unless the programmer specifies a workaround flag.
If you're new-ish to anura, and you don't know about this flag, you may try to rotate or scale an object, and be dismayed when it doesn't work correctly. Because the nature of it not working correctly (incorrect centering) is a seemingly shallow implementation mistake, I worry most users will jump to the conclusion that our engine is unfinished and buggy, rather than realizing we have a specific workaround for that. Rotation isn't something that should need a wiki article, or a caveat - it's a common feature in sprite-graphics engines, with some level of expected behavior (like rotating around the middle if a rotation point isn't specified).
Right now, of course, we flag an object animation with
no_remove_alpha_borders: true
to completely turn off this feature. Unfortunately, because we apply this to absolutely every object that rotates or scales, we've had to apply this to a total of ~100 objects so far.Suggested Fix:
I think we can get the best of both worlds, though, by tweaking the feature - by simply limiting our current "border shrinkage" such that it doesn't reduce an object's area beyond the point where doing so would alter the midpoint. For most objects, this would mean we'd still remove ~98% of the unused alpha borders around the sprite. But moreover - we'd be able to bring possibly all objects currently flagged with
no_remove_alpha_borders
back within the fold - as long as their midpoint was preserved, it would be okay to cull significant portions of their sprites.Not only would this make anura easier to use, it would open up the possibility of applying rotation to arbitrary objects in the editor (something that may be very desirable for games other than frogatto - a good example of why this would be desirable would be the following video showing aquaria's editor: http://youtu.be/bsT6otdcTv0 ).