Tilengine 2.12 released: Tile & sprite 90º rotation
This release adds a new feature: Tiles on a tiled layer and sprites can be drawn rotated 90º applying a specific flag in its attributes.
This flag existed for Tiled editor compatibility but was not used. Now the renderer processes it accordingly. Combining it with horizontal and vertical flip flags allows to rotate tile brushes and sprites in steps of 90º.
Using rotated tiled brushes in Tiled editor renders correct results.
This screenshot shows a single tiled brush drawn with all combinations of rotation, horizontal and vertical flip flags, and and the same "eagle" sprite using combination of flags to simulate all possible rotations in 90º steps clockwise.
The code for the applying the four rotations is this:
TLN_ConfigSprite(0, spriteset, 0); TLN_ConfigSprite(1, spriteset, FLAG_ROTATE | FLAG_FLIPX); TLN_ConfigSprite(2, spriteset, FLAG_FLIPX | FLAG_FLIPY); TLN_ConfigSprite(3, spriteset, FLAG_ROTATE | FLAG_FLIPY);
Right now this feature has the following restrictions:
- Layers with simple scaling applied won't rotate tiles. The other modes -normal, affine transform and pixel mapping) apply it correctly
Only squared -same width and height- and non-scaled sprites are rotated.
- These limitations may be removed in future version, but for the time being I prefer not to delay this release.
Hope you enjoy it!
Leave a comment
Log in with itch.io to leave a comment.