2D Toolkit Forum
2D Toolkit => Support => Topic started by: AGP on April 18, 2012, 10:12:47 pm
-
I have a two-frame collection whose Count variable is storing 3. What gives? Would looping with Count-1 make sense?
-
Not sure. Which accessor are you using specifically?
If you're talking about the SpriteCollectionData.Count property, then this is actually possible. The sprites are stored by ID to avoid any name resolving at any stage. The editor handles deleting of sparse values by nulling out the data - i.e. the slot still exists. Newly created sprites will then take over this empty space later. For the most part you don't have to care about this, or even be aware that this even happened.
The order of sprites / frames aren't guaranteed to match any particular order. If you'd like an ordered list, the simplest method to do this is to create a SpriteAnimation, create a clip, and add frames in the order you'd like them to appear in, and get the IDs out of this list at runtime.
-
I don't understand your question. Where me is an instance of tk2dSprite, the line print(me.collection.Count) prints 3 where it should print 2.
-
Yes, its the same thing I was talking about then - check post above.