2D Toolkit Forum
2D Toolkit => Support => Topic started by: Zama Games on April 28, 2013, 01:29:02 pm
-
Hi, I have a set of sprites some of which aren't perfectly centered inside the image (and this must be that way). I am trying to use tk2dClippedSprite to cut the sprite into 4 parts but unfortunately the clipping coords are applied to the trimmed sprite and not the whole sprite.
E.g. here is the initial sprite which I want to cut into 4 equal parts (see "initial_spr.png")
(http://www.frostball.com/initial_spr.png)
So, I create 4 ClippedSprite's with the following clipping coords:
( (0, 0), (0.5, 0.5) )
( (0.5, 0), (1, 0.5) )
( (0, 0.5), (0.5, 1) )
( (0.5, 0.5), (1, 1) )
and expect to get this (see "req_cuts.png")
(http://www.frostball.com/req_cuts.png)
But I get this (see "clipped_cuts.png")
(http://www.frostball.com/clipped_cuts.png)
Is it at all possible to get what I need with the provided ClippedSprite class?
Any other solution?
Thanks!
-
That looks like a bug. I'll look into it.
For now, a temporary fix could be disabling trimming on that sprite alone.
-
Thanks, hm, unfortunately i can't disable trimming since the sprites are very large and with trimming disabled the atlases which I'd have to generate to fit everything in will exceed 50MB or even 100MB.
Please let me know when you would be able to publish a fix. I guess I'd have to delay publishing of the game for now until there is a fix and start working on another one I have in the plan.
-
I've got a fix for this now. It wasn't as bad as I thought it'd be.
Drop me an email at support and I'll send you a patch.
-
Amazing :) Thanks for the fast reply and fix :)