Reset world??

Blitz3D Forums/Blitz3D Programming/Reset world??

Joey(Posted 2005) [#1]
Is there a good way to pretty much delete everything in the world except what is there when you start. I want to delete everything when someone creates a new project so they can start from scratch.


asdfasdf(Posted 2005) [#2]
ClearWorld


asdfasdf(Posted 2005) [#3]
ClearWorld


GfK(Posted 2005) [#4]
Clearworld doesn't clear sounds, type collections, arrays, or images.


Picklesworth(Posted 2005) [#5]
It does, however, clear the world.


Joey(Posted 2005) [#6]
thx thats prob the best way.


starfox(Posted 2005) [#7]
ExecFile("yourfile.exe")
End
?


Joey(Posted 2005) [#8]
hmm. Well i did try the clearworld and thats a bad idea. It deletes everything uncluding my gui and this would cause more work and pain to reload it all over again.

The exec file is ok but when they click new it dont just delete everything it actually deleted wat was made in a prev proj and inserts the new terrain that the user defines in the new project window. It works just like making a new project in photoshop or the like.


Jeremy Alessi(Posted 2005) [#9]
Keep track of everything that is added or have a template to load from.


Matty(Posted 2005) [#10]
I agree with Jeremy - it is good practice to design your code so that it is easy to keep track of everything that is added (and in some cases removed).

(see http://www.blitzbasic.com/Community/posts.php?topic=45478 )


GfK(Posted 2005) [#11]
I agree with Jeremy too. Doing what starfox said and just relaunching the exe is the ugliest, laziest, most unprofessional way of doing this.


_PJ_(Posted 2005) [#12]
It depends on why you wish to clear everything, and whether it's just entities & sprites or whether you need to reset variables too etc. The following should take care of everything:

1)
Have everything that is level-related or whatever 'stored' in custom Types. This way, the Types can be cleared with a simple routine.


2)
Parent Everything Level related to a special pivot. make sure the child entities are ENTITYNAMEd like "Mesh_" or "Sprite_, At the moment of CLEARing, free all these entities, and clear the pivot.


Joey(Posted 2005) [#13]
sweet deal thats wat i will do. It would make for easy undo/reddo also.