forums

TNT Basic Forums > Programming Q&A
sprite off problem
< Last Thread     Next Thread >
Author
Thread        Post A Reply

10-03-2003 03:15

Posted by:
JAS

Click Here to Email JAS   Find more posts by JAS

Everytime I use the sprite off command wether the sprite ID follows it or not the sprite doesn't turn off, but instead gets replaced with a random image from the graphics I have in the file.

And I tested just using sprite off without a sprite ID and some sprites got turned off, but others also got replaced with the same image that wasn't supposed to be associated with that sprite in the first place (it's not even in the sprite's image bank).

Could this be a bug in tntbasic?

This problem has popped up in three different games that I've begun coding.

Thanks for the help!

10-03-2003 04:49

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

It sounds like you are turning the sprite off, thus dumping the info about the bank it's supposed to use, and the sprite is being immediately turned back on, using the default bank to grab images from.

10-03-2003 04:52

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

Oh, and when you use sprite off without an id, it turns all the sprites off, and when they get turned on, some of them use the same image from the default image bank while others, which use images that do not exist in the default bank, have no image.

10-03-2003 15:31

Posted by:
JAS

Click Here to Email JAS   Find more posts by JAS

Interesting, I was the impression that sprite off was used when you kill a baddie and want hit to be taken off the screen completely.

How do I fix this? Or is there another command used to just kill it and have him gone for good (at least for that level that is :) )?

10-03-2003 22:53

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Sprite off DOES kill the image. But you may just show it again a few lines later...

e.g:

int lives=10

while true

lives=lives-1
if lives=0 then sprite off 1

sprite 1,100,100,0 'when sprite off 1 is called this line puts the sprite back on screen

wend


Try this:

int lives=10

while true

lives=lives-1
if lives<=0 then sprite off 1

if lives>0 then sprite 1,100,100,0 'when sprite off 1 is called this line isn't called again

wend

10-03-2003 23:53

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

What Matthew said is what I meant; that you were turning the sprites off but in some other section of the code were calling each sprite again, thus turning them back on.

10-05-2003 23:03

Posted by:
JAS

Click Here to Email JAS   Find more posts by JAS

so, what I really have to do is turn off (skip, whatever) the sprite 1,x,y,0 line, right?

That's what I was thinking of doing since I thought that sprite off wasn't working. Makes sense now.

but if I skip the sprite 1,x,y,0 to not render a sprite then what is the point of the sprite off line?

10-05-2003 23:59

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Because if you don't put sprite off the sprite will just stay there, still.

10-07-2003 20:23

Posted by:
JAS

Click Here to Email JAS   Find more posts by JAS

I figured as much when I thought about it. Thanks for the help in clarifying that!!!

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.