Author Topic: Custom Sprite Dimensions and Atlas Changes  (Read 4297 times)

jehk

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Custom Sprite Dimensions and Atlas Changes
« on: January 22, 2014, 03:58:07 PM »
I have a bunch of sprites that all sit next to each other in a scene (ie a character portrait frame). Due to texture filtering there's a little gap between each sprite despite being right next to each other. I fix that by modifying the sprites dimensions so its 1 pixel smaller on all sides (ie x + 1 and y + 1; width - 2, height - 2). However, every time I update that sprite (or any sprite in the atlas) I have to redo the sprite's dimensions.

Is there anything I can do about that? Only thing I can think of is using a custom packer. It's becoming a real chore.

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Custom Sprite Dimensions and Atlas Changes
« Reply #1 on: January 23, 2014, 06:36:05 AM »
You're modifying the sprite's dimensions? Why not position your UISprites so that they overlap by a pixel instead?

jehk

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Custom Sprite Dimensions and Atlas Changes
« Reply #2 on: January 23, 2014, 01:28:14 PM »
EDIT: Okay! I thought about this a bit more and found a simple solution. I'm using the techniques from your Sliced & Tiled Sprite howto video. My UI is now a bunch of tiled sprites with borders attached to each other using anchors (the new system is pretty cool btw). I'll have to manually slice a few sprites but that's no problem compared to what I was doing before.

...

Mainly because our HUD is semi-transparent.

What's the best way to fix the gaps between adjacent sprites that are supposed to tile (but are not actually tiled sprites)?

While the method I'm using works I feel there has to be a better way. Hopefully I'm not being too obtuse and missing an obvious fix.

Thanks again.
« Last Edit: January 23, 2014, 05:12:23 PM by jehk »