def pre_update(self, events): key_left = Keyboard.check('key1_left', events) key_right = Keyboard.check('key1_right', events) self.key_left = key_left and not key_right self.key_right = key_right and not key_left self.key_shoot = Keyboard.check_pressed('key1_shoot', events)
def pre_update(self, events): super().pre_update(events) # Pre update the current screen self.current_screen.pre_update(events) # Pause the game if Keyboard.check_pressed('pause', events): self.director.push_scene(scenes.Pause()) self.snd_click.play()
def pre_update(self, events): super().pre_update(events) # Closes the pause menu if Keyboard.check_pressed('pause', events): self.snd_click.play() self.director.pop_scene() else: # Pre update the current screen self.current_screen.pre_update(events, self)
def pre_update(self, events): # Check if any key has been pressed if not self.transition and Keyboard.check_pressed('any', events): # Starts the transition self.transition = True # Make the screen shake self.shake = True # Play the transition sound self.snd_transition.play()
def pre_update(self, events, scene): if self.is_selected and not scene.is_fading: # Execute if Keyboard.check_pressed('interact', events): self.execute(scene) # Key up elif Keyboard.check_pressed('up', events): self.key_up(scene) # Key down elif Keyboard.check_pressed('down', events): self.key_down(scene) # Key left elif Keyboard.check_pressed('left', events): self.key_left(scene) # Key right elif Keyboard.check_pressed('right', events): self.key_right(scene)
def pre_update(self, events): self.key_interact = Keyboard.check_pressed('interact', events)