forums

TNT Basic Forums > Programming Q&A
Recurser help
< Last Thread     Next Thread >
Author
Thread        Post A Reply

07-30-2002 18:53

Posted by:
mark

Click Here to Email mark   Find more posts by mark

Recurser errors: TNT Basic does not recognise the procedure name, also it highlights the '-1' and 'end if' as syntax errors.

Procedure MovePlayer (5) 'Moves player left or right without turning depending on arrow keys pressed.

if 5=>0
MovePlayer(5-1) 'Recursion calls the procedure from inside itself.
end if

07-30-2002 19:03

Posted by:
Mark Tully

Find more posts by Mark Tully

End Proc

Check you've got an 'end proc' after your if statement. Without an end proc, the procedure definition is not valid.

Thanks,

Mark

07-30-2002 21:39

Posted by:
Daniel Lurie

Click Here to Email Daniel Lurie   Find more posts by Daniel Lurie


if 5=>0
MovePlayer(5-1) 'Recursion calls the procedure from inside itself.
end if


Shouldn't that be of 5>=0?

07-31-2002 02:16

Posted by:
Danlab games

Click Here to Email Danlab games   Find more posts by Danlab games

Dont know exactlly what you whant to do but..


MovePlayer(5)

procedure MovePlayer(int mov)
if mov=>0
MovePlayer(mov-1)
end if
end proc
end

See ya

07-31-2002 02:18

Posted by:
Danlab games

Click Here to Email Danlab games   Find more posts by Danlab games

oups

better like this:


MovePlayer(5)

procedure MovePlayer(int mov)
if mov=0
MovePlayer(mov-1)
end if
end proc
end

See ya

08-01-2002 08:07

Posted by:
DanLab games

Find more posts by DanLab games

the first exemple is better :-)

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.