TheBoneJarmer / TiledCS

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

Issues retrieving parallax x/y factors from a TiledLayer #85

Closed Frankfires closed 2 years ago

Frankfires commented 2 years ago

While being able to retrieve other layer properties from my TiledLayers strangely enough TiledLayer.layer.parallaxX/Y have both always returned 0 for me, which is strange since the default values of the parallax scrolling factors are set to 1. Inside of my .tmx map file I can see the parallax scale factors set for each of my layers and it seems to be correct image image image image

TheBoneJarmer commented 2 years ago

Hey

Thanks for reporting! I will have a look at it.

With kind regards, TheBoneJarmer

TheBoneJarmer commented 2 years ago

Hey

I just learned that I wrongly mapped the parallaxX and parallaxY attribute. Fucked that one up pretty good ghehe. Made a patch and hopefully within a few minutes the new NuGet package is available. :D

With kind regards, TheBoneJarmer

Frankfires commented 2 years ago

The fix seems to be working slightly, I was able to retrieve the parallax factor from only one of my layers though, which was (2, 2). My layers with decimal factors don't seem to be working, and my layers with the default parallax factor of (1, 1) return (0, 0), I'm gonna assume this has something to do with the .tmx files not including parallax values for each layer if they are the default (1, 1), so maybe have TiledLayer.parallaxX/Y have a default of (1, 1) this way nobody has to multiply their parallax camera shenanigans by (0, 0). Appreciate ya taking the time to fix this :)

image image image image

TheBoneJarmer commented 2 years ago

Oh fuck me haha, was not even aware of that. My apologies! And thank you for letting me know! You were correct about your assumption. The default is indeed 1,1 but is not saved until it gets changed. Well spotted. I will correct that and send a new patch on your way. :)

TheBoneJarmer commented 2 years ago

The new NuGet has been published in the meantime. The new version is 3.2.3.

Frankfires commented 2 years ago

Tile/object layers are working like charms, awesome appreciate you fixing this 👍 ( I think you just need to touch up on image layers, still getting 0 from both parallax values :P ) image image

TheBoneJarmer commented 2 years ago

Hey

Glad to hear!! And thanks for pointing that one out. I made some changes on develop just now that fixes that, added support for the class attribute on a layer (heck, never knew it was possible lol) and done rid of some warnings. I'm cool with releasing another patch but if you don't need this asap I'd rather wait till I got a bunch of stuff again. D:

With kind regards, TheBoneJarmer

Frankfires commented 2 years ago

A quick patch would be greatly appreciated around now but I understand that releasing small tiny minimal patches with very little changes isn't ideal, your call.

TheBoneJarmer commented 2 years ago

Than I'll do it. I was not sure you meant you just noticed or that you actually needed it right now. But it seems the latter is the case. Hence I just pushed out a new release. I already got a notification from TeamCity that the build succeeded so within a couple of minutes the NuGet package should be available. :)

Mind you, it is not a patch this time but a minor release because I changed the property type string to an enum as requested by someone else. You might need to change that as well.

TheBoneJarmer commented 2 years ago

Hey @Frankfires

Just to be certain, you mentioned things work flawlessly in the other issue. Does that mean this one is solved for you as well?

With kind regards, TheBoneJarmer

Frankfires commented 2 years ago

Yes, I am now able to retrieve parallax values from image layers, thanks for the fix :D

TheBoneJarmer commented 2 years ago

Awesome 😎