GLBasic forum

Main forum => Bug Reports => Topic started by: Hemlos on 2009-Aug-27

Title: GENSPRITE()
Post by: Hemlos on 2009-Aug-27
Seems this function isnt working...value always 0

hello=GENSPRITE()
hello2=GENSPRITE()
hello3=GENSPRITE()
PRINT hello3,10,10
SHOWSCREEN
MOUSEWAIT

results:
hello3=0
Title: Re: GENSPRITE()
Post by: Kitty Hello on 2009-Aug-27
No, it's OK. Because you didn't acutally create a sprite on that slot.
Title: Re: GENSPRITE()
Post by: Hemlos on 2009-Aug-27
Oh i see, you must immediately use the value or it resets, you cant just use it sequentially.
Thanks!
Title: Re: GENSPRITE()
Post by: MrTAToad on 2009-Aug-27
Thats right - it will only increase when you actually load a sprite.
Title: Re: GENSPRITE()
Post by: Moru on 2009-Aug-28
I would guess GENSPRITE() Just goes thru the sprites and checks what sprite numbers don't hold a sprite yet and gives you that number. If you don't use it you will just end up with the same number next time you ask for a free number.