TNT Basic Forums > Programming Q&A
Index variables
< Last Thread     Next Thread >
Thread        Post A Reply

10-31-2002 19:32

Posted by:

Click Here to Email mark_667   Find more posts by mark_667

The following code is included in the game to check that characters weren’t walking through buildings in one of the level maps, however, when I try to run it I get the error: "The index variable in a for loop must be an index variable or an item front he integer array" I have shortened it to only the relevant pieces for convenience.
Any help or ideas will be useful, Thanks in advance.

‘Sprite to tile collision for ‘city’ map
float hitOtherSprite=true,hitOtherSpriteúlse,speed=6
‘ test for collisions with the buildings
for image bank 128 Sprite 0 and Sprite 1 and sprite 4 and sprite 6 and sprite 8 and sprite 9
Sprite col rect (5,7 to 7,7)
if sprite col rect 1,7 to 1,10
else sprite col rect, etc
else sprite col rect, etc ‘lots of these
float hitOtherSprite=true
float hitRect = false
The words ‘hitOtherSprite’ are highlighted, anyone know why this is or how I can get round it?

P.S. Do you think the message boards can get smilies like the TNT Central forums?

11-01-2002 09:23

Posted by:
John Treece-Birch

Find more posts by John Treece-Birch

For Loops

For loops are supposed to look something like this...

int n
for n=0 to 50 step 2
next n

This will perform the loop, increasing the value of n by 2 each time, until it is equal to 50. That is pretty much all a for loop does, it can't be used to access sprites out of an image bank.


11-01-2002 20:58

Posted by:

Click Here to Email eLL   Find more posts by eLL

Then what would you suggest

Wow what would you suggest, to accomplish this John, perhaps a while wend ?

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.