forums

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

02-21-2004 23:01

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

can you give a sprite a name instead of just a number. like, instead of 0,1,2,3,4,5 i could name them ball, bat, bumper1, bumper2, bumper3.

02-21-2004 23:07

Posted by:
-wyvern

Location:
Bedroom

Find more posts by -wyvern

Yeah, I remember the way metal did it was that you assigned a variable to a sprite, and it held the sprites reference. That way you could use arrays and so on, which would be damn handy.

On the other hand, TNT is still evolving, wheras metal doesn't seem to be...

02-21-2004 23:28

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

you can assign sprites to variables and use them in arrays in tnt. i do it all the time:

procedure placeSprites()
shared float ballX, ballY, batX, batY, ballDx, ballDy
shared int batSprite, ballSprite
int i
'place the bat sprite
sprite 0, batX, batY, batSprite
'place the ball sprite
sprite 1, ballX, ballY, ballSprite
'place mobile sprites
for i = 0 to (nMobileParts-1) step 1
sprite i+2, partX{i}, partY{i}, partSprite{i}
next i
end proc

02-21-2004 23:29

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

hmmm. i guess i kinda forgot why i asked that question.

02-22-2004 21:36

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

Sure you could...though it might not be what you have in mind:

int ball=1
sprite ball, 10,10,0

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.