2D Toolkit Forum

2D Toolkit => Support => Topic started by: evax on June 12, 2013, 05:20:58 am

Title: bug report
Post by: evax on June 12, 2013, 05:20:58 am
1. create spritecollection
2. add spritesheet and set texture (ex: desert.png 100 x 100 tile size 50 x 50 )
3. commit

than add sprite desert/0 ~ desert/9

and sprite definitions size is 10

4. add some sprite ( ex: glass.png )
5. commit

and sprite definitions size is 11

6. remove sptrite desert/8, desert/9
7. commit

but not change sprite definitons size
(still 11)
Title: Re: bug report
Post by: evax on June 12, 2013, 05:22:50 am
sorry (ex: desert.png 100 x 100 tile size 50 x 50 ) is wrong

(ex: desert.png 100 x 100 tile size 20 x 50 ) is correct
Title: Re: bug report
Post by: unikronsoftware on June 12, 2013, 10:15:22 am
That isn't a bug, actually but I understand how it causes confusion. The sprite definition count, doesn't actually change. It is an array that only resizes itself when allowed. This is so spriteIDs actually stay the same for sprites that already exist.

If you need to count the actual number of valid sprites in a sprite collection and or process them in whatever way, then run through spriteDefinitions, and ignore ones that are !Valid.
Title: Re: bug report
Post by: Serge on July 18, 2017, 11:38:57 pm
is there any way to cleanup this data? i really want to get rid of all those unused sprite definitions.
Title: Re: bug report
Post by: unikronsoftware on July 21, 2017, 09:16:12 pm
Hi,

There isn't any way to do this (well there is, but its convoluted). Basically, the id is used by sprite instances to tell it what sprite its using. Its legacy stuff, not pretty, but I would just write a few functions to work around it if it is genuinely an issue. What problem are you trying to work around?