Restart a game.. or load one... etc..
Blitz3D Forums/Blitz3D Beginners Area/Restart a game.. or load one... etc..
| ||
hi.. i have a game... start with a menu options. "new game, load, exit...." when i choose (start) the program load 3D, variables etc... and start the game... if i press "ESC" back to menu..... in case i choose "Exit", how can i clean all memory data? if i choose "New game", i need to clear all data, and restart the game again... but crash becouse there is already data loaded in the first time y play the game... there is a command or way to do that? thanks again.. |
| ||
ClearWorld(). |
| ||
:) perfect!... thanks!!! but, the variables don't reset with clearworld... |
| ||
Heh, i'll try to help... Make a function called Reset if you havent already and then have it reset all variables back to their original numbers or strings like this x = 22 mehcode$ = "cake" mehcode = "cow" Function Reset(); x = 22 mehcode = "cake" End Function And just use that to reset EVERYTHING (Someday i'd love to learn how to use Data and WriteFile and all that other stuff to make a savable\loadable map) |
| ||
thanks, thats go to work fine , but i have more than 300 variables... :) |
| ||
what i do is i create a function that calls other functionsfunction setup() loadworld loadplayer loadotherrandomthings run end function the run command is the main loop and the menu calls setup when you click start. |
| ||
Of course you have to reset the variables yourself. How could ClearWorld possibly know which variables to reset, and to what value? ;) |