TheBoneJarmer / TiledCS

TiledCS is a dotnet library for loading Tiled tilesets and maps
MIT License
139 stars 51 forks source link

Flipped objects throw an OverflowException on ParseXml #90

Closed juanferrer closed 2 years ago

juanferrer commented 2 years ago

ParseObjects doesn't check nor clear flip flags, so int.Parse throws an OverflowException when attempting to parse a flipped object.

Started making a pull request, but wasn't sure if you wanted another set of 6 functions called IsObjectFlipped... or adding three booleans to the object itself. So I'll leave the implementation to you =].

TheBoneJarmer commented 2 years ago

Hey @juanferrer

Thanks for letting me know. Will have a look at it!

With kind regards, TheBoneJarmer

TheBoneJarmer commented 2 years ago

Hey @juanferrer

I just published TiledCS 3.3.2. This includes a fix for the error you got as well as extra stuff to fetch the flipped state of a tile linked to an object. To start with, each object now has a field dataRotationFlag. This is similar to the TiledLayer.dataRotationFlags field.

And just like with tiles you can use the helper methods IsTileFlippedDiagonal, IsTileFlippedVertical and IsTileFlippedHorizontal. These now accept a parameter of type TiledObject. I'd say, give it a shot and let me know if it works for you. :)

With kind regards, TheBoneJarmer

TheBoneJarmer commented 2 years ago

Didn't hear back so I assume all went well. If not do not hesitate to open up this issue again. :)

juanferrer commented 2 years ago

Oh, sorry. Yes, my bad. The update fixed it. Thanks!