GENSPRITE()

Previous topic - Next topic

Hemlos

Seems this function isnt working...value always 0

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

results:
hello3=0
Bing ChatGpt is pretty smart :O

Kitty Hello

No, it's OK. Because you didn't acutally create a sprite on that slot.

Hemlos

Oh i see, you must immediately use the value or it resets, you cant just use it sequentially.
Thanks!
Bing ChatGpt is pretty smart :O

MrTAToad

Thats right - it will only increase when you actually load a sprite.

Moru

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.