I’ve set up my game to cleanup everything and return to the main menu, when the user exits the game. When the user presses play, he enters
the game “with a clean slate”.
My problem is that everything has been cleaned up, except the collision thing (the red thing that is seen when you uncomment
self.cTrav.showCollisions(render)). The used one is left behind, and a
new one create each time the game starts.
I am not sure, but I believe it has something to do with
self.playerZcol.traverse(render) in this code:
Code:
# Update Player Z (Keep player on Terrain)
def updatePlayerZ(self, time):
if self.page == 1:
startpos = self.Mod1.getPos()
self.playerZcol.traverse(render)
if self.playerZcolQueue.getNumEntries>0:
self.playerZcolQueue.sortEntries()
point = self.playerZcolQueue.getEntry
(0).getSurfacePoint(self.env)
self.Mod1.setZ(point.getZ())
else:
self.Mod1.setPos(startpos)
# End updatePlayerZ
Is there a code I can use to clean this up when I end the game?
Also, is there a code in Panda, that calls “restart game”?
Thanks