Removing or switching sprites.

Previous topic - Next topic

Omegavolt

Hey all,

I read through the manual and searched the forums, but for some reason I can't seem to find the command for either removing or switching out a sprite.  Though I suppose if I knew how to remove one, it would be a simple matter to load another one in the same spot.  I tried KILLFILE, but that actually does remove the file from my project folder, and I usually need the sprite back.

Thanks!

Synthetic

To remove a sprite from memory just use loadsprite with a file name that doesn't exist. IE
LOADSPRITE "does_not_exist.bmp",1

To change the image of a sprite just use a different ID# of another loaded sprite. You can also change it by specifying LOADSPRITE to load a different image at the time but this is not really worthwhile inside a main loop as it will the decrease performance of your program.

If you need more help, let me know. =D
"Impossible is a word people use to make themselves feel better when they quit."

My AMXMODX plugins for Day of Defeat 1.3 can be found here.

Kitty Hello

I think you have a wrong understanding of sprites in GLBasic. A Sprite is there when you paste it, and after the SHOWSCREEN everything is gone. It's more a stamp than a hardware sprite in the sense of 8 bit computers.

See this:
Code (glbasic) Select
LOADSPRITE "bubble.bmp", 0
main:
   MOUSESTATE mx, my, b1, b2
   SPRITE 0, mx, my
   SHOWSCREEN
GOTO main