Пример #1
0
    def start(self):
        # Change the current screen
        self.current_screen = self.screen_play

        # Change the background music
        SoundManager.load_music('bgm_stage' + str(random.randint(2, 6)) +
                                '.ogg')
Пример #2
0
    def __init__(self):
        super().__init__()

        # Load the screen for the current stage
        state = Config.state()
        entities = (Player(Colors.VIR),
                    Enemy(state['color'], state['shoot_delay']))
        self.screen_intro = ScreenIntro(entities, state['balls'])
        if Config.level == 4:
            self.screen_play = ScreenHardcore(entities, state['balls'],
                                              state['max_balls'],
                                              state['max_score'])
        else:
            self.screen_play = ScreenNormal(entities, state['balls'],
                                            state['max_balls'],
                                            state['max_score'])

        # Set the current screen
        self.current_screen = self.screen_intro

        # Pause sound
        self.snd_click = SoundManager.load_sound('snd_click.wav')

        # Play the background music
        SoundManager.load_music('bgm_stage1.ogg')
Пример #3
0
    def __init__(self, update=True):
        super().__init__()

        # Repeat cutscene
        if not update:
            Cutscene.current_cutscene -= 1
            ScreenDialog.current_dialog -= 1
            SoundManager.load_music('bgm_dialog.ogg')

        # Change level
        if Cutscene.current_cutscene in (4, 6, 8, 11, 14, 17):
            Config.level += 1

        # Background
        state = Config.state()
        self.background = ScreenBackground(
            (Player(Colors.VIR), Enemy(state['color'], state['shoot_delay'])))

        # Transition
        self.transition = False
        self.transition_delay = 50
        self.snd_transition = SoundManager.load_sound('snd_transition1.wav')

        # Set the current screen
        if Cutscene.current_cutscene in (1, 4, 8, 11, 14, 17):
            self.current_screen = ScreenNarrator()
        elif Cutscene.current_cutscene in (3, 6, 7, 10, 13, 16, 19):
            self.current_screen = ScreenDialog()
            SoundManager.load_music('bgm_dialog.ogg')
        else:
            self.current_screen = ScreenDialog()
Пример #4
0
    def __init__(self, text_code):
        super().__init__()

        self.is_selected = False

        self.opacity = 128
        self.text_code = text_code
        self.text = LanguageManager.load_text(text_code)
        self.font = FontManager.load_font('neogen.ttf', 24)

        self.snd_click = SoundManager.load_sound('snd_click.wav')
        self.snd_choice = SoundManager.load_sound('snd_choice.wav')
Пример #5
0
    def __init__(self):
        super().__init__()

        # Load the screen for the multiplayer stage
        entities = (Player1(Colors.VIR), Player2(Config.state()['color']))
        balls = [(65, 175, 10), (185, 175, 10)]
        self.current_screen = ScreenIntro(entities, balls)
        self.screen_play = ScreenInfinite(entities, balls, 10)

        # Pause sound
        self.snd_click = SoundManager.load_sound('snd_click.wav')

        # Play the background music
        SoundManager.load_music('bgm_stage1.ogg')
Пример #6
0
    def __init__(self):
        # Load text
        self.line_list = []
        ScreenNarrator.current_narrator += 1
        for phrase in LanguageManager.load_text('narrator' + str(ScreenNarrator.current_narrator)):
            self.line_list.append(phrase)

        # Text info
        self.current_index = 0
        self.current_string = ''
        self.current_line = ''
        self.input_string = self.line_list[0]

        # Text location
        self.text_x = 44
        self.text_y = 258
        self.line_length = 500 - self.text_x * 2
        self.font = FontManager.load_font('neogen.ttf', 24)

        # Interaction sounds
        self.snd_blit = SoundManager.load_sound('snd_blip.wav')
        self.snd_blit.fadeout(0)

        # Interaction delay
        self.interval = 2   
        self.ticks = 0     
        self.sleep_ticks = 0

        # Interaction
        self.key_interact = False
Пример #7
0
    def __init__(self, x, y, radius):
        super().__init__()

        self.x = x
        self.y = y
        
        self.hspeed = 0
        self.vspeed = 0
        
        self.radius = radius
        self.min_x = radius
        self.max_x = 250 - radius
        self.min_y = -radius
        self.max_y = 350 + radius

        self.snd_collide = [SoundManager.load_sound('snd_collide' + str(i) + '.wav') for i in range(3, 5)]
        self.snd_score = [SoundManager.load_sound('snd_score' + str(i) + '.wav') for i in range(1, 4)]
        self.snd_explosion = SoundManager.load_sound('snd_explosion.wav')
Пример #8
0
    def __init__(self, victory=False):
        super().__init__()

        # Background
        state = Config.state()
        self.background = ScreenBackground(
            (Player(Colors.VIR), Enemy(state['color'], state['shoot_delay'])))

        # Screens
        self.screen_menu = ScreenMenu(self)
        self.screen_options = ScreenOptions(self)

        # Set the current screen
        self.current_screen = self.screen_menu

        # Play the background music
        if victory:
            SoundManager.load_music('bgm_victory.ogg')
        else:
            SoundManager.load_music('bgm_menu.ogg')
Пример #9
0
    def __init__(self, entities, balls):
        super().__init__(entities, balls)

        # Screen shake
        self.shake = False

        # Instructions
        self.instructions = Instructions()

        # Transition
        self.transition = False
        self.transition_delay = 50
        self.snd_transition = SoundManager.load_sound('snd_transition2.wav')
Пример #10
0
    def __init__(self, x, y, color, angle, radius):
        super().__init__()

        speed = 200 - radius
        self.x = clamp(x + speed * math.cos(math.radians(angle)), radius,
                       250 - radius)
        self.y = clamp(y + speed * math.sin(math.radians(angle)), 0, 350)
        self.color = color
        self.angle = angle
        self.radius = radius
        self.max_radius = radius

        self.collide = False
        self.snd_collide = [
            SoundManager.load_sound('snd_collide' + str(i) + '.wav')
            for i in range(1, 3)
        ]
Пример #11
0
    def __init__(self, undo=False):
        super().__init__()

        self.undo = undo

        # Background
        self.background = pygame.display.get_surface().copy()

        # Screens
        self.screen_pause = ScreenPause(self)
        self.screen_options = ScreenOptions(self)

        # Set the current screen
        self.current_screen = self.screen_pause

        # Click sound
        self.snd_click = SoundManager.load_sound('snd_click.wav')
Пример #12
0
    def __init__(self, entities, balls, max_balls):
        super().__init__(entities, balls)

        # Screen shake
        self.shake = False
        self.shake_duration = 6
        self.shake_time = self.shake_duration

        # Score
        self.score = False
        self.player_score = 0
        self.enemy_score = 0

        # Balls
        self.stage_balls = balls
        self.ball_delay = 300
        self.ball_time = self.ball_delay
        self.max_balls = max_balls
        self.snd_ball = [SoundManager.load_sound('snd_ball' + str(i) + '.wav') for i in range(1, 4)]
Пример #13
0
    def __init__(self, x, y, color, angle, min_angle, max_angle):
        super().__init__()
        
        self.x = x
        self.y = y
        self.color = color
        self.arc_angle = angle
        self.min_angle = min_angle
        self.max_angle = max_angle

        self.radius = 200

        self.cooldown = 0
        self.max_cooldown = 20
        
        self.polygon_angle = 0
        self.polygon_smooth = 0
        self.polygon_points = 12

        self.snd_shoot = [SoundManager.load_sound('snd_shoot' + str(i) + '.wav') for i in range(1, 5)]
Пример #14
0
    def __init__(self):
        # Load text
        self.sprite_list = []
        self.line_list = []
        ScreenDialog.current_dialog += 1
        for phrase in LanguageManager.load_text(
                'cutscene' + str(ScreenDialog.current_dialog)):
            self.sprite_list.append(phrase['sprite'])
            self.line_list.append(phrase['dialog'])

        # Generate portraits
        self.speaker = 0
        self.portrait = {}
        self.portrait_left = Portrait(0, 186)
        self.portrait_right = Portrait(244, 186)
        self.portrait_right.pause()
        for sprite in list(set(self.sprite_list)):
            portrait = {}
            portrait['original'] = SpriteManager.load_sprite(sprite)
            portrait['original_flip'] = pygame.transform.flip(
                portrait['original'], True, False)
            portrait['shade'] = SpriteManager.load_sprite(sprite)
            portrait['shade'].fill(Colors.ALPHA_LIGHT_GREY,
                                   special_flags=BLEND_MULT)
            portrait['shade_flip'] = pygame.transform.flip(
                portrait['shade'], True, False)
            self.portrait[sprite] = portrait

        # Assign sprites
        sprite_left = self.sprite_list[0]
        sprite_right = self.sprite_list[1]
        pos = 1
        while sprite_left == sprite_right:
            pos += 1
            sprite_right = self.sprite_list[pos]
        self.sprite_left = self.portrait[sprite_left]['original_flip']
        self.sprite_right = self.portrait[sprite_right]['shade']

        # Generate box
        self.spr_box = draw_box(SpriteManager.load_sprite('spr_box.png'), 29,
                                6)
        self.box_x = 2
        self.box_y = 442
        self.spr_box_pause = slice_sprite(
            SpriteManager.load_sprite('spr_box_pause.png'), 16, 16)
        self.box_pause_x = self.box_x + 480
        self.box_pause_y = self.box_y + 112
        self.box_pause_index = 0

        # Text info
        self.current_index = 0
        self.current_string = ''
        self.current_line = ''
        self.input_string = self.line_list[0]

        # Text location
        self.text_x = self.box_x + 20
        self.text_y = self.box_y + 20
        self.line_length = 500 - self.text_x * 2
        self.font = FontManager.load_font('neogen.ttf', 24)

        # Interaction sounds
        self.snd_blit = SoundManager.load_sound('snd_blip.wav')
        self.snd_blit.fadeout(0)

        # Interaction delay
        self.interval = 2
        self.ticks = 0
        self.sleep_ticks = 0

        # Interaction
        self.key_interact = False
Пример #15
0
    def start(self):
        # Change the current screen
        self.current_screen = self.screen_play

        # Change the background music for the current stage
        SoundManager.load_music(Config.state()['music'])
Пример #16
0
 def execute(self, scene):
     self.snd_click.play()
     SoundManager.set_music(self.option / 10)
Пример #17
0
 def cancel(cls, scene):
     button = cls.instances[scene]
     button.option = int(button.original * 10)
     SoundManager.set_music(button.original)
Пример #18
0
 def execute_async(self, scene):
     SoundManager.load_music('bgm_dialog.ogg')
     scene.exec_play()
Пример #19
0
    def __init__(self, button):
        super().__init__()

        self.button = button

        self.snd_click = SoundManager.load_sound('snd_click.wav')