Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
starting over doesnt clear variables???
#1
in my program i have the option "new" so if the user selects this option i tell it to goto start: which is the veryfirst command in the program, when you veryfirst run the program everything works fine but when i tell it "new" to start over i get a semi blank page my game piece is there and the enemy piece is there but i dont have my walls or nothing but shouldnt it be there if essentially the program is starting over again?
o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
Reply
#2
hmmmm let's see the code.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#3
if your program looks anything like this:

start:
dim x as integer
dim y as integer
...
if something then goto start
...

Then no, it won't (and shouldn't) clear those variables. What you could do is to use run to restart the program (RUN "filename.bas") where filename.bas is the filename of your program, but it's a hack and you'd be better off just clearing the variables you need to clear manually.
Reply
#4
CLEAR
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#5
You should initialise your variables every time.
roeten van Frenkel
Visit us at The Official S&F PROD. Homepage
Reply
#6
Quote:CLEAR
Doesn't do the same thing in FB.
Reply
#7
Just because you tell the program to go to a label at the beginning of a program doesn't mean it's going to automagically reset all its variables. All you're doing is redirecting program flow.
I'd knock on wood, but my desk is particle board.
Reply
#8
i did as joakim said and just simply ran the program over and it fixed my problem im still in the disign stage of my game but i will post my code if more wish to view it
o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)