Author Topic: Reordering of sprite upon addition to Atlas  (Read 2662 times)

honohanf

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Reordering of sprite upon addition to Atlas
« on: June 06, 2014, 02:40:07 PM »
Hey, how's it goin folks?

I've incorporated a spinning coin sprite into my HUD, and the sprites are labelled coin1,coin2,... all the way up to coin12. But what seems to be happening in the UISpriteAnimation is that it goes from 1 to 10 then 11,12 and back to 2 through to 9 then restarts at 1.

Has anybody else come across anything like this? I think it might be something to do with Atlas packing but can't be sure.

And unfortunately there's no method to expose the sprites and reorder them in the Sprite Animation.

Are sprites limited to (0) or 1-9? I've got 12.

Any information would be greatly appreciated.

honohanf

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Reordering of sprite upon addition to Atlas
« Reply #1 on: June 06, 2014, 02:54:26 PM »
It seems the standard Sort() function in the RebuildSpriteList() function is producing an incorrect result.

As I labelled my spritesheet sprites from 1 and not zero, replacing the call to mSpriteNames.Sort() with the following did the trick:


         int amountOfSprites=mSpriteNames.Count;
         mSpriteNames.Clear();
         for(int i = 1;i<amountOfSprites;i++)mSpriteNames.Add (mPrefix+i);