def on_enter(self): eventbus.bind_listener(self.handle_key_next_level, KEYUP) pr = assets.images['player'].get_rect().copy() pr.centerx = self.game.display.get_rect().centerx pr.y = self.game.display.get_rect().bottom - pr.height - 20 self._player = Entity(pr.x, pr.y, pr.w, pr.h) self._particles.clear()
def __init__(self): self.display = pygame.display.set_mode((1200, 800)) assets.initialize_assets() self._clock = pygame.time.Clock() self._time_delta = 0.016 self._running = True self._paused = False self._star_field = StarField(1200, 800, 30, 50) self._cur_scene = '' self._scenes = {} eventbus.bind_listener(self.pause_game, pygame.KEYUP) eventbus.bind_listener(self.quit_game, pygame.QUIT) self.build_scenes() self._scenes[self._cur_scene].on_enter() self._change_scene_to = None
def on_enter(self): eventbus.bind_listener(self.key_pressed, KEYDOWN) eventbus.bind_listener(self.key_released, KEYUP)
def on_enter(self): eventbus.bind_listener(self.handle_key_up, KEYUP)
def on_enter(self): eventbus.bind_listener(self.log_mouse_move_pos, PG_MOUSE_MOVE) eventbus.bind_listener(self.check_mouse_clicks, PG_MB_RELEASE) eventbus.bind_listener(self.switch_to_test, KEYUP)