TNT Basic Forums > Programming Q&A
How do you restart the game after you lose?
< Last Thread     Next Thread >
Thread        Post A Reply

06-08-2006 20:41

Posted by:

Click Here to Email Harry-combs   Find more posts by Harry-combs

Im trying to make it so that when you lose if you press Y then to restart the game. How do I do this?

06-08-2006 21:25

Posted by:

Click Here to Email puffin   Find more posts by puffin

what i used to do is use a goto statement to reinitialize the game. there's better ways, but its been a while since i've used tnt, and goto is quick and easy. just don't abuse it.

06-08-2006 23:11

Posted by:

San Francisco, CA

Click Here to Email Jacob   Find more posts by Jacob

I don't know if it is easy to implement, but this is how I set up my games:

'Press space to play, press Q to exit.
If space then game()
If pressed(12) then break

Procedure game()
End Proc

That way when the game ends you can just press space again to replay.

P.S. What kind of game is it? So many people talk about their game and don't share them.

06-08-2006 23:17

Posted by:

Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

i strongly recommand you don't use goto, it leads to what is well known as 'spaghetti code'

split your code into many procedures is the best way, not only to restart game but also to make code more organized and more readable

you might not find that interesting but trust me it's worth it... the bigger the project gets, the more you'll lose control over it if it's not organized - in the past i've dropped many projects i had started because i couldn't follow my own code anymore! learn from my mistakes ^_^ !

09-19-2006 12:50

Posted by:

Click Here to Email appleide   Find more posts by appleide

also - leave comments everywhere

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.