def enter(self): BaseNodeScript.enter(self) # hold the camera fixed self.game.getView().getCameraController().disable() self.music = self.game.getMusic() res = self.game.getResources() self.list1 = res.loadPlaylist('list1') self.list2 = res.loadPlaylist('list2') self.music.setPlaylist(self.list1) self.music.play() self.game.getInput().addMappings('playlist-control')
def enter(self): BaseNodeScript.enter(self) #setup the initial board ord0 = ord('0') startTxt = self.game.getResources().loadText('start_pos.txt') for c in startTxt: if c <= '9' and c >= '0': self.initBoard.append(ord(c) - ord0) self.board.extend(self.initBoard) #setup the solution matrix solTxt = self.game.getResources().loadText('solution_pos.txt') for c in solTxt: if c <= '9' and c >= '0': self.solutionBoard.append(ord(c) - ord0) self._createHotspots()
def enter(self): ''' Here we initialize some fields and flags and setup our UI which constists only of labels. ''' # call the super class implementation first, this is optional BaseNodeScript.enter(self) self.sounds = self.game.getSoundsFx() # hold the camera fixed self.game.getView().getCameraController().disable() # display instructions self.instructions = OnscreenText(text = 'Press 1 for blah-blah, 2 for cling and 3 for zipper', pos = (base.a2dLeft + 0.1, 0.9), align = TextNode.ALeft, scale = 0.07, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7) ) # gets the status of sounds self.lastStatus = self.sounds.isEnabled() self.soundsStatusText = OnscreenText(text = 'Sounds status: %s' % self.lastStatus, pos = (base.a2dLeft + 0.1, 0.8), align = TextNode.ALeft, scale = 0.07, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) self.volumeText = OnscreenText(text = 'Volume: %.1f' % self.sounds.getVolume(), pos = (base.a2dLeft + 0.1, 0.7), align = TextNode.ALeft, scale = 0.07, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) self.rateText = OnscreenText(text = 'Rate: %.1f' % self.sounds.getPlayRate(), pos = (base.a2dLeft + 0.1, 0.6), align = TextNode.ALeft, scale = 0.07, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) self.balanceText = OnscreenText(text = 'Balance: %.1f' % self.sounds.getBalance(), pos = (base.a2dLeft + 0.1, 0.5), align = TextNode.ALeft, scale = 0.07, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) self.loopText = OnscreenText(text = 'Looping: %d' % self.looping, pos = (base.a2dLeft + 0.1, 0.4), align = TextNode.ALeft, scale = 0.07, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) self.eventText = OnscreenText(text = 'Finished event received', pos = (base.a2dLeft + 0.1, 0.3), align = TextNode.ALeft, scale = 0.07, fg = (1.0, 0.0, 0.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) self.eventText.hide() OnscreenText(text = 'Press P, R to pause/resume playing sounds', pos = (base.a2dLeft + 0.1, 0.2), align = TextNode.ALeft, scale = 0.05, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) OnscreenText(text = 'Press L, Shift-L to increase/decrease the loop count', pos = (base.a2dLeft + 0.1, 0.1), align = TextNode.ALeft, scale = 0.05, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) OnscreenText(text = 'Press +, - to increase/decrease playing rate', pos = (base.a2dLeft + 0.1, 0.0), align = TextNode.ALeft, scale = 0.05, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) OnscreenText(text = 'Press [, ] to decrease/increase sound volume', pos = (base.a2dLeft + 0.1, -0.1), align = TextNode.ALeft, scale = 0.05, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) OnscreenText(text = 'Press D, E to disable/enable sounds', pos = (base.a2dLeft + 0.1, -0.2), align = TextNode.ALeft, scale = 0.05, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) OnscreenText(text = 'Press B, Shift-B to increase/decrease balance', pos = (base.a2dLeft + 0.1, -0.3), align = TextNode.ALeft, scale = 0.05, fg = (1.0, 1.0, 1.0, 1.0), shadow = (0.0, 0.0, 0.0, 0.7), mayChange = True ) # add our input mappings to the active mappings, the existing mappings were not deleted # but they can be partially overridden by this. self.game.getInput().addMappings('sounds')
def enter(self): BaseNodeScript.enter(self) self.game.getView().getCameraController().disable() self.game.getView().getTalkBox().setFontName('default') self.game.getView().getTalkBox().showText('text.mf', 1000)