linux-man / p5.tiledmap

Use Tiled maps on p5.js
GNU Lesser General Public License v2.1
63 stars 16 forks source link

Orthographic rotation/flipping #6

Open jgordon510 opened 4 years ago

jgordon510 commented 4 years ago

I noticed that rotation/flipping wasn't supported. Flipped and rotated tiles do not show up. This is because the flips are encoded in three bits at the end of the number, which changes the decimal value stored on the data map. In order to display the flipped tiles, you need to strip these bits from the number. I also used these bits to affect the rotation, which required using translation inside a push/pop instead of drawing directly at the x/y coordinates.

In another issue, I talked about how I got multiple tilesets with selective loading implemented. This requires stripping the bits at the point of load as well, to get the proper tile number, to determine if it's present on the map.

Please let me know if you'd like to implement my changes.