ClearWorld and Includes??

Blitz3D Forums/Blitz3D Programming/ClearWorld and Includes??

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

you dont need to.

For eg.
sourcemonster=loadmesh ("mysourcemonster")

This would be loaded and never disposed of.
Then, when you want to add say a monster or a load of trees or something:

createmonster(sourcemonster,100,0,100)
function createmonster(sm,x,y,z)  ; 
   m.monster=new monster
   m\hand=copyentity(sm)
   m\startpositionX=x
   m\startpositionY=y
   m\startpositionZ=z
   etc...
end function
To delete a monster data item ie, has been killed:
freeentity m\hand:delete m
This will not only delete the 3d resource but the entire "record" (m) in the datastructure (assuming m.monster is locally valid)

To delete all monsters when changing level:
for m.monster=each monster 
   freeentity m\hand
   delete m
next

Obviously for large unique items like the main level mesh and music etc you use a global and can clean this as normal with a simple:
freeentity (G_mainlevelmesh):G_mainlevelmesh=0
Its always a good idea to reset the vars value to 0 as you can still use "if NOT myhandle then.... " to detect any non loaded resources (to avoid potential MAVs ).