
-----------------------------------
Snicket
Mon May 29, 2006 6:45 pm

Eliminating Variables
-----------------------------------
Is there any way that one can delete a variable totaly.


Simple as that.

-----------------------------------
Cervantes
Mon May 29, 2006 6:55 pm


-----------------------------------
In Turing? 'fraid not.

However, you use free to do something similar, though the data that you are deleting must be an object, collection, type... (it must be referenced by a pointer).

-----------------------------------
Tony
Mon May 29, 2006 6:56 pm


-----------------------------------
as Cervantes says, you can free an object

or reduce the size of a flexible array

-----------------------------------
Snicket
Mon May 29, 2006 7:11 pm


-----------------------------------
In my case I am trying to reset my variable to thier original values. It should be easy but it is causing a lot of problems. I am missing a variable in my program I guess. Well Thanks Anyway.

-----------------------------------
Snicket
Mon May 29, 2006 7:24 pm


-----------------------------------
Alright. My problem is that in my game, when one dies and click on the play button again, none of the sprites show up. My code is rather sloppy, sorry

-----------------------------------
Cervantes
Mon May 29, 2006 7:26 pm


-----------------------------------
If you're trying to reset a single variable to its starting value, just declare a constant of the same name (though use a capital letter to start it) and assign it the initial value. Then when you want to reset the variable, assign it to the value of the constant.

If you need to do this for a lot of variables, it would be much wiser to have all your initial values stored in a file. Read them in at the start of the program and reread them in whenever you want to reset your variables.

-----------------------------------
Snicket
Mon May 29, 2006 8:03 pm


-----------------------------------
My main problem is that the sprites declared when the program is first run do not redraw themselves when the program is run again. They dont even appear when redeclared. The game continues to run so it is definately the sprites. I just have no idea.
