Setting a sprite's anchor points for handling in movement,
animation, collision etc.
5. New visual attributes for sprites:
- Rotation angle
sprites anchor point should be just an offset, not limited to
'topleft', 'midtop', 'topright',... and the other rect
I want to be able to specify "center" or "midbottom" for
the sprite anchor without knowing the image's dimensions. And
I want that anchor point to remain in the appropriate place
even if the image is rotated, scaled, or flipped. I'm not sure
that an offset would accomplish this, but if so, then that's
I agree, what I suggested is that both things should be possible: a
general offset and/or specifying 'center' or 'midbottom' or....
I'm not sure right now how the math to maintain the point at the
appropriate place. Maybe this needs some more specification for the
different transformations (rotation, flip, scale).
Well the desired behavior is pretty straightforward to me. Say I specify a sprite's anchor as "midbottom", and the sprite's image has a single orange pixel at its mid-bottom. Then if I ask to draw the sprite at (200, 100), then that orange pixel should wind up at (200, 100) no matter how the sprite is transformed (maybe one pixel off because of rounding). The math shouldn't be too hard to work out from that.