Well, i know this is not a panda itself question, but it related to python…
Objective is to skip you press a key multiple times, for instance, you press a key, and that key calls a method, but if you press again, nothing occur, but problems present when you press the same key more than 1 time and reload that method, … and if that method contains loader of models, will multiply every time when you press the key…
Just for what i´m doing, the beginning of the game shows a short video of introduction, then loads the “Press Start to Continue” screen, (in my case, start is space-key). As well, you see the second screen (press space to continue), if you press space, loads the menu, that is all right, but if you press space again, then system will load again the menu, and again… again… etc… etc…, the idea is to deactivate the space-key sensor if already pressed one time. I was thinking about booleans variables, but can´t imagine how to put in order them.
this is that i have :
def _loadTitle(self):
self.setMenu = True
if self.setMenu == True:
self.accept("space", self._loadMenu)
def _loadMenu(self):
self.setMenu = False #self.accept musn't execute with this..
self.titleBgm.stop()
self.titlePlane.detachNode()
Stage_0()
m = Main()
run()
thank you .!