def animate(self, x): """ Move everything """ start_time = timeit.default_timer() arcade.process_2d_physics_movement(self.sprite_list, gravity=0.08) arcade.process_2d_physics_collisions(self.sprite_list) # -- Left flipper control if self.left_flipper_state == FLIPPER_UP and self.left_flipper_list[ 0].center_y < 145: y = 2 y_change = 2 for sprite in self.left_flipper_list: sprite.change_y = y y += y_change sprite.frozen = False elif self.left_flipper_state == NO_FLIPPER and self.left_flipper_list[ 0].center_y > 135: y = -2 y_change = -2 for sprite in self.left_flipper_list: sprite.change_y = y y += y_change sprite.frozen = False else: for sprite in self.left_flipper_list: sprite.change_y = 0 sprite.frozen = True # -- Right flipper control if self.right_flipper_state == FLIPPER_UP and self.right_flipper_list[ 0].center_y < 145: y = 2 y_change = 2 for sprite in self.right_flipper_list: sprite.change_y = y y += y_change sprite.frozen = False elif self.right_flipper_state == NO_FLIPPER and self.right_flipper_list[ 0].center_y > 135: y = -2 y_change = -2 for sprite in self.right_flipper_list: sprite.change_y = y y += y_change sprite.frozen = False else: for sprite in self.right_flipper_list: sprite.change_y = 0 sprite.frozen = True for sprite in self.sprite_list: if sprite.center_y < -20: sprite.kill() self.time = timeit.default_timer() - start_time
def animate(self, x): """ Move everything """ start_time = timeit.default_timer() arcade.process_2d_physics_movement(self.object_list) arcade.process_2d_physics_collisions(self.object_list) self.time = timeit.default_timer() - start_time
def update(self, x): """ Move everything """ start_time = timeit.default_timer() arcade.process_2d_physics_movement(self.object_list) arcade.process_2d_physics_collisions(self.object_list) self.player.velocity = [0, 0] self.time = timeit.default_timer() - start_time
def animate(self, x): """ Move everything """ start_time = timeit.default_timer() arcade.process_2d_physics_movement(self.sprite_list, gravity=0.08) arcade.process_2d_physics_collisions(self.sprite_list) # -- Left flipper control if self.left_flipper_state == FLIPPER_UP and self.left_flipper_list[0].center_y < 145: y = 2 y_change = 2 for sprite in self.left_flipper_list: sprite.change_y = y y += y_change sprite.frozen = False elif self.left_flipper_state == NO_FLIPPER and self.left_flipper_list[0].center_y > 135: y = -2 y_change = -2 for sprite in self.left_flipper_list: sprite.change_y = y y += y_change sprite.frozen = False else: for sprite in self.left_flipper_list: sprite.change_y = 0 sprite.frozen = True # -- Right flipper control if self.right_flipper_state == FLIPPER_UP and self.right_flipper_list[0].center_y < 145: y = 2 y_change = 2 for sprite in self.right_flipper_list: sprite.change_y = y y += y_change sprite.frozen = False elif self.right_flipper_state == NO_FLIPPER and self.right_flipper_list[0].center_y > 135: y = -2 y_change = -2 for sprite in self.right_flipper_list: sprite.change_y = y y += y_change sprite.frozen = False else: for sprite in self.right_flipper_list: sprite.change_y = 0 sprite.frozen = True for sprite in self.sprite_list: if sprite.center_y < -20: sprite.kill() self.time = timeit.default_timer() - start_time
def animate(self, delta): if self.current_state == GAME_RUNNING: arcade.process_2d_physics_movement(self.world.main_list, gravity=0.6) arcade.process_2d_physics_collisions(self.world.main_list) self.world.animate(delta)