Hello Guest

Author Topic: Extracting tk2dSpriteCollectionData from tk2dSpriteCollection  (Read 4682 times)

brain56

  • Newbie
  • *
  • Posts: 1
    • View Profile
Extracting tk2dSpriteCollectionData from tk2dSpriteCollection
« on: September 19, 2012, 02:30:16 am »
Noob question. Haha. I'd like to extract the tk2dSpriteCollectionData from a given tk2dSpriteCollection. How do I do this? I can't seem to find any methods related to this. Thanks!  ;D

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Extracting tk2dSpriteCollectionData from tk2dSpriteCollection
« Reply #1 on: September 19, 2012, 09:50:50 am »
The member you want is .spriteCollection
Why do you need this? Its probably not a good idea to rely on this - the next version will have more than 1 data object attached to one object for runtime atlas swapping, etc. If you tell me your needs then perhaps I could suggest something which won't break in the next version.

wagenheimer

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Re: Extracting tk2dSpriteCollectionData from tk2dSpriteCollection
« Reply #2 on: November 25, 2013, 05:36:04 pm »
Well... I need to change the SpriteCollection from the sprite in RunTime, how this is possible without breaking anything (SetSprite requires a SpriteCollectionData for this)?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Extracting tk2dSpriteCollectionData from tk2dSpriteCollection
« Reply #3 on: November 25, 2013, 06:26:42 pm »
Why do you need to assign the SpriteCollection rather than the data object? The SpriteCollection itself contains references to your source images, etc. and should never be used at runtime. The data object is what contains the optimised atlas and no references to the source images.