Removing models

Blitz3D Forums/Blitz3D Programming/Removing models

TomFeatherhill(Posted 2015) [#1]
Hey. I've got a Sonic game and I plan to make it have multiple stages. I realised that if I loaded a second stage, it would result in loading it on top of the first stage.

Is there anyway of removing all the models from the previous stage prior to placing the next stage on it?

Here's my current structure:

;Globals
Global PlayerName ...

;Loop One
Loop
    ;Menu and settings codes
    PlayerName$ = "Sonic" ...
    ;Loop 2
    Loop
        ;Rendering
        Player = LoadAnimMesh(PlayerName) ...
        ;Loop 3
        Loop
            ;Updating and Controls
            imports "controls.bb" ...
        End Loop
    End Loop

End Loop



videz(Posted 2015) [#2]
Just use FreeEntity

like..
FreeEntity Player


or

FreeEntity Stage1


or whatever stage mesh entity you have.

http://www.blitzbasic.com/b3ddocs/command.php?name=FreeEntity


GfK(Posted 2015) [#3]
For more complex situations, parent every mesh you load to a single pivot. Then all you have to do is call FreeEntity(pivot) to clear out the whole lot.


TomFeatherhill(Posted 2015) [#4]
Thank you guys for the answers >w<