2
« on: April 23, 2013, 03:40:36 am »
Thanks for the reply!
If a platform specific sprite sheet will automatically handles the resizing that will save me a lot of work. I'm used to creating a unit sized quad then scaling and texturing it for sprites. I'm assuming on the back end it's creating the quad vertices based on the size of the image and the target resolution which is why all sprites are pixel perfect at a scale of 1?
I have a couple follow up questions, though. We are targeting multiple platforms with multiple resolutions (and aspect ratios but that's a different beast all together) and I was trying to reuse the same camera and world space for all those resolutions since certain things in the game are not sprites but invisible information for pathing and are tied to the initial scale we applied to our world.
I'd previously been using an ortho camera with a size to match the world space and plotted the vertices on a path relative to that size. Switching to the tk2dCamera and resetting the sprite collections, all the sprite sizes have changed so now the path no longer lines up with the image. This is the reason why I wanted to scale the sprites myself and only swap the textures without resizing them for other resolutions. What I've done instead is set the target height for the sprite collections to the pixel dimension of our background and an ortho set to our world scale. I then use this with a basic Unity camera with the same ortho size. I gave up on scaling to world size since a sprite that isn't square is still scaled by 1 and even changing the ortho, I'd still have to modify each sprite (or head down a code path I'd rather not) to make things scale with the world. So what I did is for any object with a sprite, create a child with the logic (which uses the scale values for some calculations) and a parent with the sprite scaled to 1. It seems to all be playing nicely together but just wanted to confirm that this is a good approach to use with the 2d toolkit. I'd rather try to use the framework 'how it's supposed to' as opposed to bending it to my will as in my experience it's not worth the effort to not play by a frameworks standards (that doesn't just go for tk2d but for unity in general which was a huge shift away from my usual C++ low level coding).
And while I'm here, I was looking at the platform specific sprite sheet settings and I see the 1x 2x and 4x scales. Setting them sends it out to automatically search for files and then returns an error. I'm going to assume I'll need to use the iOS standard of throwing 2x and 4x at the end of the file name?
Also, the platform flag will only work for resolutions that are multiples of each other (like iOS devices), correct? If I want to support various Android dimensions or Desktop windows, is it easiest to load up a different camera/collection set for each platform and aspect ratio?