Hello Guest

Author Topic: Is there how to create sprites from same texture dynamically?  (Read 3286 times)

lofl

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
I create sprite dynamically using CreateFromTexture.
And I want to create some more sprite from that texture.

Simply I copy code CreateFromTexture, one more spritecollection is created.
But I want to reuse texture.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Is there how to create sprites from same texture dynamically?
« Reply #1 on: June 06, 2013, 09:37:16 pm »
Create a sprite collection at runtime.
Use tk2dSpriteCollectionData.CreateFromTexture to create it.

Then create a sprite, and SetSprite( ... )

lofl

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Is there how to create sprites from same texture dynamically?
« Reply #2 on: June 10, 2013, 03:28:17 am »
I did it!

Thanks!!