2D Toolkit Forum
2D Toolkit => Support => Topic started by: spinner on September 29, 2013, 12:39:21 pm
-
Hello,
Imagine that I want to create a tiled bridge with a blue semi-transparent sprite.
Im using 40x40 sprites and Then I'm scaling x40.
What does the final size really means, is there a formula to know the current sprite size? How can I measure the size of a sprite in units so I know exatctly where I can position the next one?
Right now I'm adding the one with x+5, and it's almost correct (as attached), but there's a line between the sprites that I don't want to appear, I want them to connect seamsleesly.
And actually, the sprite itself seems to have a border that I didn't add (as you can see on the image as well). I created a plain blue semi-transparent and yet, after the commit to the atlas, it seems that the sprite collection created a border for it. So even if I add like x+4.95 (which I would prefer having more round values), the line will be there.
What am I doing wrong? Is there any trick or documentation that I need to read to understand how this work better?
-
Have you set this up correctly?
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,294.0.html
The final size depends on how you set up the camera / sprite collection size.
If you set it up at 1 pixel per meter, then a 40x40 sprite will be exactly 40 units in size. At 10 pixels per meter, it'll be 4 units in size, etc.
-
And in the case I'm using a perspective camera? Is there a way to calculate that?
-
offset it by sprite.GetBounds().size.x/y - that will be the size of the sprite.
Or use a tk2dTiledSprite instead.
-
Cool, thanks! Btw, the trick with the the Pad method worked and now I can use 5 units distance normally. :)