whole game reset

is there any way to reset the game comlpetely?

like turning the clock back to 0 or something like that

because right now i have a situation where i have 2 levels in my game, and the player can select either one in the level selection screen

when i enter say level 1 the first time, its fine
but when i complete or exit the level and try to play level 1 again, the models from the first time dont dissapear

i have tried destroy, removeNode, remove, del, i think most of the things that can remove stuff completely but none have worked

so i am wondering if there is some sort of alternative, like maybe resetting the game when a player has played through the levels

The best way is to just keep track of everything you do and load to do clean up that way. There is another trick, but its a little to powerful for most users. I can’t seem to remember the code, but you can easly find it on the forum some place around here.

okay fair enough, but do you have any recomendations on what terms to use in my search?

because i am not sure if my terms are correct

and by “keep track of everything you do”, do you mean like,like is it asking the game to record it in a txt file like some ind of log?

render.removeNode() or something like that I think. Like I said, I sorta forgot the command. Its been a while, but its best not to do that.

Best to make one model, then right after make its removeNode() self and move them to another def to be deleted laterd.
This is what I mean by keep track over everything you do.

self.Gun = Loader.load(gun)
def LoadModels(self):
  self.Gun = Loader.load(gun)
def ClearUpModels(self):

Also, when you load up all your veriables, just make a singal def that you can recall to “reset” them.

def LoadVeriables(self):
  self.GunOne = True
  self.GunTwo = True

As for going back to the main menu… just call up all your clean up, then recall man menu…

def ClearUpModels(self):
def LoadVeriables(self):
  self.GunOne = True
  self.GunTwo = True
-Game1 or Game2

I’m kinda waiting for a similar answer here: discourse.panda3d.org/viewtopic.php?t=8264 (last post).
But for NodePaths it should be .remove()

I guess it depends on what you want to clear. Simply changing the vaule clears said x veriable, so up to you on how you want to do that lol.

actually i intend to delete my entire level, just a FYI

everything from Nodes to models

tnx for all the replies, i am quite surprised by the overwhelmingly fast rate of replies honestly

ill return with queries again when ive bumped into any problems after trying out all of your suggestions

thanx again

Note that my link is more a question than an answer, so I may be totally wrong

Heres a neat little trick for clean up too…

DeleteList = [self.MenuBackGround, self.SettingsButton, self.SoundSettingsButton, self.KeyBoardSettingsButton, self.VideoSettingsButton, self.MainMenuButton, self.ReturnGameButton, self.ExitButton]
for x in DeleteList:

If you create a simple node you can attach everything to that node instead of render. Deleting that node should remove all children of it (I think, I just woke up so I am probably wrong :wink: )

And don’t forget to attach that node to render itself :wink:

dummynode = render.attachNewNode('dummynode')