def ball_init(self, sfx):
        ball_sprite = SpriteFactory("images/ball-small.png")
        ball_frames = SpriteFactory.generate_frames(ball_sprite, data.ballFramesData)
        ball = Ball(self.sprite_group, (constants.BALL_INIT_POS[0], constants.BALL_INIT_POS[1]), ball_frames, sfx, speed=100)
        ball.play(Animation.INFINITE)

        ball_shadow_sprite = SpriteFactory("images/ball-shadow.png")
        ball_shadow_frames = SpriteFactory.generate_frames(ball_shadow_sprite, data.ballShadowFramesData)
        ball_shadow = BallShadow(self.focus_effect_group, ball, ball_shadow_frames, speed=1000)
        ball_shadow.play(Animation.INFINITE)
        return ball
 def focus_effect_init(self):
     focus_effect_sprite_red = SpriteFactory("images/hover-red.png")
     focus_effect_frames_red = SpriteFactory.generate_frames(focus_effect_sprite_red, data.hoverEffectFramesData)
     focus_effect_sprite_blue = SpriteFactory("images/hover-blue.png")
     focus_effect_frames_blue = SpriteFactory.generate_frames(focus_effect_sprite_blue, data.hoverEffectFramesData)
     focus_effect_blue = FocusEffect(self.focus_effect_group,
                                     self.userList[0].players_list[self.userList[0].current_selected_player],
                                     focus_effect_frames_blue, speed=1000)
     self.focus_effect_list.append(focus_effect_blue)
     self.focus_effect_list[0].play(Animation.INFINITE)
     focus_effect_red = FocusEffect(self.focus_effect_group,
                                    self.userList[1].players_list[self.userList[1].current_selected_player],
                                    focus_effect_frames_red, speed=1000)
     self.focus_effect_list.append(focus_effect_red)
     self.focus_effect_list[1].play(Animation.INFINITE)
 def __init__(self, manager, sprite, frame_data, player_initial_position, ball, sfx):
     # Call the parent's constructor
     pygame.sprite.Sprite.__init__(self)
     self.change_x = 0
     self.change_y = 0
     self.frames = []
     self.manager = manager
     player_frames = SpriteFactory.generate_frames(sprite, frame_data)
     image = player_frames[0]
     self.frames.append(image)
     self.manager.add(self)
     # Set the image the player starts with
     self.image = self.frames[0]
     # Set a reference to the image rect
     self.rect = self.image.get_rect()
     # self.center = self.rect.width / 2, self.rect.height / 2
     self.rect.x = player_initial_position[0]
     self.rect.y = player_initial_position[1]
     self.radius = 37
     self.m = 50
     self.collision = Collision()
     self.ball = ball
     self.player_list = []
     self.sfx = sfx
     self.player_vs_ball_observable = PlayerVsBallObservable()
     self.player_vs_ball_observer = PlayerVsBallObserver(sfx)
     self.player_vs_ball_observable.register(self.player_vs_ball_observer)
     self.direction = [0, 0]
 def goal_effect_init(self):
     goal_effect_sprite = SpriteFactory("images/goal-screen.png")
     goal_effect_frames = SpriteFactory.generate_frames(goal_effect_sprite, data.goalEffectFramesData)
     self.goal_effect = GoalScreen(self.goal_effect_group, goal_effect_frames)