Restored from previous forum. Originally posted by WolfgangS.
Hi !
How is the fastest way to clear a Sprite ?
Delete it and create a new one ? Or copy an other Sprite on it ?
Or an other way ?
Best regards & MFG
:)WolfgangS
Clear a Sprite ?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
Hope i didn't missunderstood what yuo were looking for..
I don't know which is fastest, but if you just want to clear out all data in the sprite and keep the sprite number, you don't have to delete it first you just create a new one on top of the old one, PB internally deletes sprites if you use the same spriteindex number. If my writing is incomprehensable maybe an example would help:Originally posted by WolfgangS
Hi !
How is the fastest way to clear a Sprite ?
Delete it and create a new one ? Or copy an other Sprite on it ?
Or an other way ?
:)WolfgangS
Code: Select all
#SPRITEINDEX = 20 ; just some number for the example.
LoadSprite(#SPRITEINDEX, "sprite.bmp") ; Ok we got a sprite.
...
; Now to clear this sprite:
CreateSprite(#SPRITEINDEX, SpriteWidth(#SPRITEINDEX), SpriteHeight(#SPRITEINDEX))
; Ok so now we have a clean sheet