TNT Basic Forums > Bugs!
For construct. Is this a bug.
< Last Thread     Next Thread >
Thread        Post A Reply

08-02-2003 09:54

Posted by:
Carl PokéthulhuMasta


Click Here to Email Carl PokéthulhuMasta   Find more posts by Carl PokéthulhuMasta

I've done some process since I downloaded TNT two days ago :)
My problem this time is that my n in the For construct doesn't work.
Check this out:

sprite 0,0,player1y,0
int x=x+8
for n = 1 to 100 step 1
if poll input (1)
sprite 1,x+60,player1y-30,1
end if
if x+60 > 640 then sprite off 1
draw frame
next n

This is what it says about th bold n:
"Identifier "n" has not been declared"
I thought that the For declared it.
There's probably a perfectly simple answer to this.

This code is a game with a dragon, input 0, and a fireball 1.

08-02-2003 14:51

Posted by:

Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

"has not been declared" talks by itself. You declared the x variable, so why not declare variable n? Do like this:

int n,x

You do not need to put int to modify a declared variable. Int creates it.

int x=5


int x=5
int x=x+10

08-02-2003 15:24

Posted by:
Mark Tully

TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Also, you need to close your 'repeat' statement with a 'forever' or an 'until <expression>' line.



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.