forums

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

02-20-2004 00:38

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

in terms of peformance, is their any difference between the following:

sprite col (testSprite, fromSprite to Sprite)

and

for i = fromSprite to Sprite step 1
sprite col (testSprite, i)
next i


i'd imagine that the top is just shorthand for the bottom, but who knows?

02-20-2004 12:27

Posted by:
DanLurie

Location:
Earth>USA>New Jersey>Clifton>My Chair

Click Here to Email DanLurie   Find more posts by DanLurie

You'd be right.

02-20-2004 13:02

Posted by:
-wyvern

Location:
Bedroom

Find more posts by -wyvern

Not exactly. Basically the less you write in your code window, the faster the game will run, since TNT is running like an emulator and is parsing and translating everything it sees. Using your first example would be quicker since tnt only has to get the drift of one statement rather than three in a loop, and will probably pass the proccesing into it's own code for handling a series of collisions which will be in machine code and invariable faster than writing things out in the interpreter. Hope that makes sense.

02-20-2004 16:35

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

i said "who knows?", not "who can make a conjecture?"

but it doesn't matter anyway because i need the "i" variable, and as such i need the for loop version. i was just curious anyway.

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.