Author |
Message |
Snicket
|
Posted: Mon May 29, 2006 6:45 pm Post subject: Eliminating Variables |
|
|
Is there any way that one can delete a variable totaly.
Simple as that.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Mon May 29, 2006 6:55 pm Post subject: (No subject) |
|
|
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
|
Posted: Mon May 29, 2006 6:56 pm Post subject: (No subject) |
|
|
as Cervantes says, you can free an object
or reduce the size of a flexible array
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Snicket
|
Posted: Mon May 29, 2006 7:11 pm Post subject: (No subject) |
|
|
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
|
Posted: Mon May 29, 2006 7:24 pm Post subject: (No subject) |
|
|
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
Description: |
|
Download |
Filename: |
Outpost Defence.zip |
Filesize: |
345.87 KB |
Downloaded: |
41 Time(s) |
|
|
|
|
|
|
Cervantes
|
Posted: Mon May 29, 2006 7:26 pm Post subject: (No subject) |
|
|
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
|
Posted: Mon May 29, 2006 8:03 pm Post subject: (No subject) |
|
|
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.
|
|
|
|
|
|
|