def selectionItem(state): global isOpen if state == "down": if isActive and isOpen and (usedInterface != None): currentItem = usedInterface.getEntry("currentLine") if (currentItem == 1): # save the game Data.setData("isNewGame", False) Data.setData("lastPosition", playerBehaviour.getPlayer().getPosition()) Data.setData("lastScene", sceneBehaviour.getCurrentScene().getFileName()) Data.saveData() print('Game saved...') usedInterface.delete() Global.setInterfaceOpen(False) playerBehaviour.setControlsEnabled(True) isOpen = False characterBehaviour.stopMouvementForAllCharacters(True) else: os._exit(99)
def callFunctions(self): for function in self.functionsToCallWhenAction: function(); if self.assignedDialog != None and self.assignedDialog.getStarted() == False: if not Global.isInterfaceOpen(): dialogBehaviour.setDialog(self.assignedDialog); self.assignedDialog.setCharacter(self); self.assignedDialog.setStarted(True); dialogBehaviour.start(); Global.setInterfaceOpen(True); playerBehaviour.enableMouvement(False);
def callFunctions(self): for function in self.functionsToCallWhenAction: function() if self.assignedDialog != None and self.assignedDialog.getStarted( ) == False: if not Global.isInterfaceOpen(): dialogBehaviour.setDialog(self.assignedDialog) self.assignedDialog.setCharacter(self) self.assignedDialog.setStarted(True) dialogBehaviour.start() Global.setInterfaceOpen(True) playerBehaviour.enableMouvement(False)
def keyboardOpenPause(state): global isOpen if (state == "down" and isActive): if isOpen: usedInterface.delete() Global.setInterfaceOpen(False) playerBehaviour.setControlsEnabled(True) isOpen = False characterBehaviour.stopMouvementForAllCharacters(True) else: if not Global.isInterfaceOpen(): usedInterface.create() isOpen = True Global.setInterfaceOpen(True) playerBehaviour.setControlsEnabled(False) characterBehaviour.stopMouvementForAllCharacters(False)
def keyboardOpenPause(state): global isOpen; if(state == "down" and isActive): if isOpen: usedInterface.delete(); Global.setInterfaceOpen(False); playerBehaviour.setControlsEnabled(True); isOpen = False; characterBehaviour.stopMouvementForAllCharacters(True); else: if not Global.isInterfaceOpen(): usedInterface.create(); isOpen = True; Global.setInterfaceOpen(True); playerBehaviour.setControlsEnabled(False); characterBehaviour.stopMouvementForAllCharacters(False);
def keyboardOpenInventory(state): global isOpen; if (state == "down") and isActive and (usedInventory != None) and (usedInterface != None): if isOpen: # close it Global.setInterfaceOpen(False); usedInterface.delete(); isOpen = False; playerBehaviour.setControlsEnabled(True); else: # open it if not Global.isInterfaceOpen(): usedInterface.create(); isOpen = True; Global.setInterfaceOpen(True); playerBehaviour.setControlsEnabled(False);
def open(): global isOpen; if isActive and (usedInterface != None): if isOpen: # close it Global.setInterfaceOpen(False); usedInterface.delete(); isOpen = False; playerBehaviour.setControlsEnabled(True); GlobalVars.getVar("sounds")['thunder'].stop(); GlobalVars.getVar("sounds")['creepy'].stop(); else: # open it if not Global.isInterfaceOpen(): usedInterface.create(); isOpen = True; Global.setInterfaceOpen(True); playerBehaviour.setControlsEnabled(False);
def stop(): global isDialogStarted global currentDialog global currentIndex playerBehaviour.setControlsEnabled(True) playerBehaviour.enableMouvement(True) isDialogStarted = False currentDialog.setStarted(False) interface = currentDialog.getAssignedInterface() interface.delete() characterElement = currentDialog.getCharacter() characterElement.isWalking(True) currentDialog = None currentIndex = 1 Global.setInterfaceOpen(False)
def stop(): global isDialogStarted; global currentDialog; global currentIndex; playerBehaviour.setControlsEnabled(True); playerBehaviour.enableMouvement(True); isDialogStarted = False; currentDialog.setStarted(False); interface = currentDialog.getAssignedInterface(); interface.delete(); characterElement = currentDialog.getCharacter(); characterElement.isWalking(True); currentDialog = None; currentIndex = 1; Global.setInterfaceOpen(False);
def selectionItem(state): global isOpen; if state == "down": if isActive and isOpen and (usedInterface != None): currentItem = usedInterface.getEntry("currentLine"); if(currentItem == 1): # save the game Data.setData("isNewGame", False); Data.setData("lastPosition", playerBehaviour.getPlayer().getPosition()); Data.setData("lastScene", sceneBehaviour.getCurrentScene().getFileName()); Data.saveData(); print('Game saved...'); usedInterface.delete(); Global.setInterfaceOpen(False); playerBehaviour.setControlsEnabled(True); isOpen = False; characterBehaviour.stopMouvementForAllCharacters(True); else: os._exit(99);