コード例 #1
0
ファイル: commander.py プロジェクト: shihyu/JoustMania
 def end_game_sound(self, winning_team):
     #if self.game_mode == common.Games.JoustTeams:
     if winning_team == Team.red.value:
         team_win = Audio('audio/Commander/sounds/red winner.wav')
     if winning_team == Team.blue.value:
         team_win = Audio('audio/Commander/sounds/blue winner.wav')
     team_win.start_effect()
コード例 #2
0
ファイル: commander.py プロジェクト: shihyu/JoustMania
    def commander_intro_audio(self):
        #print 'BOOOP'
        intro_sound = Audio('audio/Commander/sounds/commander intro.wav')
        intro_sound.start_effect()
        #need while loop here
        play_last_one = True
        commander_select_time = time.time() + 50
        battle_ready_time = time.time() + 40
        while time.time() < commander_select_time:
            self.check_commander_select()
            if self.check_everyone_in():
                break

            if time.time() > battle_ready_time and play_last_one:
                play_last_one = False
                Audio('audio/Commander/sounds/10 seconds begins.wav'
                      ).start_effect()
        intro_sound.stop_effect()

        if self.current_commander[Team.red.value] == '':
            self.change_random_commander(Team.red.value)
        if self.current_commander[Team.blue.value] == '':
            self.change_random_commander(Team.blue.value)

        Audio('audio/Commander/sounds/commanders chosen.wav').start_effect()
        time.sleep(4)
        self.reset_power(Team.red.value)
        self.reset_power(Team.blue.value)
        self.commander_intro.value = 0
コード例 #3
0
 def end_game_sound(self, winning_team):
     if self.game_mode == common.Games.WereJoust:
         if winning_team == -1:
             team_win = Audio('audio/Joust/sounds/werewolf win.wav')
         else:
             team_win = Audio('audio/Joust/sounds/human win.wav')
         team_win.start_effect()
     elif self.game_mode != common.Games.JoustFFA:
         win_team_name = self.team_colors[winning_team].name
         if win_team_name == 'Pink':
             team_win = Audio('audio/Joust/sounds/human win.wav')
         if win_team_name == 'Magenta':
             team_win = Audio('audio/Joust/sounds/magenta team win.wav')
         if win_team_name == 'Orange':
             team_win = Audio('audio/Joust/sounds/human win.wav')
         if win_team_name == 'Yellow':
             team_win = Audio('audio/Joust/sounds/yellow team win.wav')
         if win_team_name == 'Green':
             team_win = Audio('audio/Joust/sounds/green team win.wav')
         if win_team_name == 'Turquoise':
             team_win = Audio('audio/Joust/sounds/cyan team win.wav')
         if win_team_name == 'Blue':
             team_win = Audio('audio/Joust/sounds/blue team win.wav')
         if win_team_name == 'Purple':
             team_win = Audio('audio/Joust/sounds/human win.wav')
         team_win.start_effect()
コード例 #4
0
    def reset_round_timer(self):
        self.revive_time = time.time() + 4
        self.revive_noise = True

        self.round_counter += 1
        self.round_time = time.time() + self.round_limit
        self.timer_beep = 4
        self.colors[self.chosen_defender].value = 1
        self.colors[self.chosen_fighter].value = 2
        print(self.score.items())
        self.set_highest_score_color()
        print(self.get_highest_score())
        print(self.high_score)
        if self.get_highest_score() > self.high_score:
            self.high_score = self.get_highest_score()
            if self.current_winner != self.chosen_defender:
                self.current_winner = self.chosen_defender
                saying = random.randint(0, 2)
                if saying == 0:
                    Audio('audio/Fight_Club/vox/' + self.voice +
                          '/defender_lead.wav').start_effect()
                elif saying == 1:
                    Audio('audio/Fight_Club/vox/' + self.voice +
                          '/defender_winning.wav').start_effect()
                elif saying == 2:
                    Audio('audio/Fight_Club/vox/' + self.voice +
                          '/Defender_high_score.wav').start_effect()
        self.check_end_game()
コード例 #5
0
ファイル: fight_club.py プロジェクト: etaiklein/JoustMania
 def check_end_game(self):
     if self.round_counter >= self.round_num:
         self.check_winner()
     if self.round_counter == self.round_num - 5:
         Audio('audio/Fight_Club/5_rounds.wav').start_effect()
     if self.round_counter == self.round_num - 1:
         Audio('audio/Fight_Club/last_round.wav').start_effect()
コード例 #6
0
ファイル: swapper.py プロジェクト: etaiklein/JoustMania
    def __init__(self, moves, command_queue, ns, music, controller_colors, dead_moves, music_speed, force_move_colors, controller_opts, controller_teams, restart):

        self.command_queue = command_queue
        self.ns = ns

        #save locally in case settings change from web
        self.play_audio = self.ns.settings['play_audio']
        self.sensitivity = self.ns.settings['sensitivity']
        self.color_lock = self.ns.settings['color_lock']
        self.color_lock_choices = self.ns.settings['color_lock_choices']
        self.random_teams = self.ns.settings['random_teams']
        
        self.move_serials = moves
        self.tracked_moves = {}
        self.dead_moves = dead_moves
        self.teams = controller_teams
        self.music_speed = music_speed
        self.music_speed.value = 1
        self.running = True
        self.force_move_colors = force_move_colors
        self.num_teams = 2
        self.restart = restart

        self.start_timer = time.time()
        self.audio_cue = 0

        self.move_opts = controller_opts

        self.update_time = 0

        self.team_colors = colors.generate_team_colors(self.num_teams,self.color_lock,self.color_lock_choices)
        self.controller_colors = controller_colors
        self.controller_colors[0] = self.team_colors[0].value[0]
        self.controller_colors[1] = self.team_colors[0].value[1]
        self.controller_colors[2] = self.team_colors[0].value[2]
        
        self.controller_colors[3] = self.team_colors[1].value[0]
        self.controller_colors[4] = self.team_colors[1].value[1]
        self.controller_colors[5] = self.team_colors[1].value[2]

        self.generate_random_teams(self.num_teams)

        if self.play_audio:

            self.start_beep = Audio('audio/Joust/sounds/start.wav')
            self.start_game = Audio('audio/Joust/sounds/start3.wav')
            self.explosion = Audio('audio/Joust/sounds/Explosion34.wav')
            fast_resample = False
            end = False
            try:
                self.audio = music
            except:
                print('no audio loaded')

        self.change_time = time.time() + 8
        self.speed_up = True
        self.currently_changing = False
        self.game_end = False
        self.winning_moves = []
        self.game_loop()
コード例 #7
0
ファイル: tournament.py プロジェクト: papapoison/JoustMania
    def __init__(self, moves, speed, command_queue, status_ns, audio_toggle, music):

        print("speed is {}".format(speed))
        global SLOW_MAX
        global SLOW_WARNING
        global FAST_MAX
        global FAST_WARNING
        
        SLOW_MAX = common.SLOW_MAX[speed]
        SLOW_WARNING = common.SLOW_WARNING[speed]
        FAST_MAX = common.FAST_MAX[speed]
        FAST_WARNING = common.FAST_WARNING[speed]

        self.audio_toggle = audio_toggle
        self.move_serials = moves

        self.tracked_moves = {}
        self.dead_moves = {}
        self.music_speed = Value('d', 1.5)
        self.running = True
        self.force_move_colors = {}
        self.invince_moves = {}
        

        self.start_timer = time.time()
        self.audio_cue = 0
        self.num_dead = 0
        self.show_team_colors = Value('i', 0)

        self.teams = {}

        self.command_queue = command_queue
        self.status_ns = status_ns
        self.update_time = 0
        
        #self.team_num = math.ceil(len(moves)/2)
        self.team_num = len(moves)

        
        self.generate_random_teams(self.team_num)

        self.tourney_list = self.generate_tourney_list(len(moves))
        fast_resample = False
        if self.audio_toggle:
            print("tourney list is " + str(self.tourney_list))

##            music = 'audio/Joust/music/' + random.choice(os.listdir('audio/Joust/music'))
            self.start_beep = Audio('audio/Joust/sounds/start.wav')
            self.start_game = Audio('audio/Joust/sounds/start3.wav')
            self.explosion = Audio('audio/Joust/sounds/Explosion34.wav')
            
            end = False
            self.audio = music
        #self.change_time = self.get_change_time(speed_up = True)
        
        self.speed_up = True
        self.currently_changing = False
        self.game_end = False
        self.winning_moves = []
        self.game_loop()
コード例 #8
0
    def commander_intro_audio(self):
        intro_sound = Audio('audio/Commander/vox/' + self.voice +
                            '/commander intro.wav')
        intro_sound.start_effect()
        #need while loop here
        play_last_one = True
        commander_select_time = time.time() + 50
        battle_ready_time = time.time() + 40
        while time.time() < commander_select_time:
            self.check_commander_select()
            if self.check_everyone_in():
                break

            if time.time() > battle_ready_time and play_last_one:
                play_last_one = False
                Audio('audio/Commander/vox/' + self.voice +
                      '/10 seconds begins.wav').start_effect()
        intro_sound.stop_effect()

        if self.current_commander[Team.alpha.value] == '':
            self.change_random_commander(Team.alpha.value)
        if self.current_commander[Team.bravo.value] == '':
            self.change_random_commander(Team.bravo.value)

        Audio('audio/Commander/vox/' + self.voice +
              '/commanders chosen.wav').start_effect_and_wait()
        self.reset_power(Team.alpha.value)
        self.reset_power(Team.bravo.value)
        self.commander_intro.value = 0
コード例 #9
0
ファイル: bubble.py プロジェクト: shihyu/JoustMania
    def __init__(self, moves):

        self.move_serials = moves
        self.tracked_moves = {}
        self.dead_moves = {}
        self.scores = {}
        self.music_speed = Value('d', 1.5)
        self.running = True
        self.force_move_colors = {}
        self.teams = {}
        self.win_amount = int(math.ceil((len(moves) / 2.0) + 2))
        self.team_num = 2

        self.generate_random_teams(self.team_num)

        music = 'audio/Joust/music/' + random.choice(
            os.listdir('audio/Joust/music'))
        self.start_beep = Audio('audio/Joust/sounds/start.wav')
        self.start_game = Audio('audio/Joust/sounds/start3.wav')
        self.explosion = Audio('audio/Joust/sounds/Explosion34.wav')
        fast_resample = False
        if len(moves) >= 5:
            fast_resample = True
        self.audio = Audio(music, fast_resample)
        #self.change_time = self.get_change_time(speed_up = True)
        self.change_time = time.time() + 8
        self.speed_up = True
        self.currently_changing = False
        self.game_end = False
        self.winning_moves = []
        self.losing_moves = []

        self.game_loop()
コード例 #10
0
 def end_game_sound(self, winning_team):
     #if self.game_mode == common.Games.JoustTeams:
     if winning_team == Team.alpha.value:
         team_win = Audio('audio/Commander/vox/' + self.voice +
                          '/red winner.wav')
     if winning_team == Team.bravo.value:
         team_win = Audio('audio/Commander/vox/' + self.voice +
                          '/blue winner.wav')
     team_win.start_effect()
コード例 #11
0
 def check_commander_select(self):
     for move_serial in self.move_opts.keys():
         if self.move_opts[move_serial][Opts.selection.value] == Selections.triangle.value and self.move_opts[move_serial][Opts.holding.value] == Holding.holding.value:
             Audio('audio/Commander/sounds/commanderselect.wav').start_effect()
             self.change_commander(move_serial)
             self.move_opts[move_serial][Opts.selection.value] = Selections.nothing.value
         elif self.move_opts[move_serial][Opts.selection.value] == Selections.a_button.value and self.move_opts[move_serial][Opts.holding.value] == Holding.holding.value:
             Audio('audio/Commander/sounds/buttonselect.wav').start_effect()
             self.move_opts[move_serial][Opts.selection.value] = Selections.nothing.value
コード例 #12
0
ファイル: commander.py プロジェクト: shihyu/JoustMania
    def __init__(self, moves):

        self.move_serials = moves
        self.tracked_moves = {}
        self.dead_moves = {}
        self.teams = {}
        self.music_speed = Value('d', 1)
        self.running = True
        self.force_move_colors = {}
        self.team_num = 2
        self.werewolf_timer = 35
        self.start_timer = time.time()
        self.audio_cue = 0

        self.move_opts = {}
        self.current_commander = ["", ""]

        self.time_to_power = [20, 20]
        self.activated_time = [time.time(), time.time()]

        self.activated_overdrive = [time.time(), time.time()]

        self.powers = [Value('d', 0.0), Value('d', 0.0)]
        #self.red_power = Value('d', 0.0)
        #self.blue_power = Value('d', 0.0)

        self.red_overdrive = Value('i', 0)
        self.blue_overdrive = Value('i', 0)

        self.generate_random_teams(self.team_num)
        self.commander_intro = Value('i', 1)

        self.powers_active = [False, False]

        try:
            music = 'audio/Commander/music/' + random.choice(
                os.listdir('audio/Commander/music'))
        except:
            print('no music in audio/Commander/music')
        self.start_beep = Audio('audio/Joust/sounds/start.wav')
        self.start_game = Audio('audio/Joust/sounds/start3.wav')
        self.explosion = Audio('audio/Joust/sounds/Explosion34.wav')
        fast_resample = False
        end = False
        try:
            self.audio = Audio(music, end)
        except:
            print('no audio loaded')
        #self.change_time = self.get_change_time(speed_up = True)
        self.change_time = time.time() + 8
        self.speed_up = True
        self.currently_changing = False
        self.game_end = False
        self.winning_moves = []

        self.game_loop()
コード例 #13
0
ファイル: commander.py プロジェクト: shihyu/JoustMania
 def overdrive(self, team):
     Audio('audio/Commander/sounds/overdrive.wav').start_effect()
     if team == Team.red.value:
         self.red_overdrive.value = 1
         self.activated_overdrive[Team.red.value] = time.time() + 10
         Audio('audio/Commander/sounds/red overdrive.wav').start_effect()
     else:
         self.blue_overdrive.value = 1
         self.activated_overdrive[Team.blue.value] = time.time() + 10
         Audio('audio/Commander/sounds/blue overdrive.wav').start_effect()
コード例 #14
0
 def play_random_instructions(self):
     if self.game_mode == common.Games.JoustFFA.value:
         Audio('audio/Menu/FFA-instructions.wav').start_effect()
         time.sleep(15)
     if self.game_mode == common.Games.JoustRandomTeams.value:
         Audio('audio/Menu/Teams-instructions.wav').start_effect()
         time.sleep(20)
     if self.game_mode == common.Games.Traitor.value:
         Audio('audio/Menu/Traitor-instructions.wav').start_effect()
         time.sleep(18)
     if self.game_mode == common.Games.WereJoust.value:
         Audio('audio/Menu/werewolf-instructions.wav').start_effect()
         time.sleep(20)
     if self.game_mode == common.Games.Zombies.value:
         Audio('audio/Menu/zombie-instructions.wav').start_effect()
         time.sleep(48)
     if self.game_mode == common.Games.Commander.value:
         Audio('audio/Menu/commander-instructions.wav').start_effect()
         time.sleep(41)
     if self.game_mode == common.Games.Ninja.value:
         Audio('audio/Menu/Ninjabomb-instructions.wav').start_effect()
         time.sleep(32)
     if self.game_mode == common.Games.Swapper.value:
         Audio('audio/Menu/Swapper-instructions.wav').start_effect()
         time.sleep(14)
     if self.game_mode == common.Games.Tournament.value:
         Audio('audio/Menu/Tournament-instructions.wav').start_effect()
         time.sleep(21)
コード例 #15
0
 def play_random_instructions(self):
     if self.game_mode == common.Games.JoustFFA:
         Audio('audio/Menu/FFA-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.JoustRandomTeams:
         Audio('audio/Menu/Teams-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.Traitor:
         Audio(
             'audio/Menu/Traitor-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.WereJoust:
         Audio('audio/Menu/werewolf-instructions.wav'
               ).start_effect_and_wait()
     if self.game_mode == common.Games.Zombies:
         Audio('audio/Menu/zombie-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.Commander:
         Audio('audio/Menu/commander-instructions.wav'
               ).start_effect_and_wait()
     if self.game_mode == common.Games.Ninja:
         Audio('audio/Menu/Ninjabomb-instructions.wav'
               ).start_effect_and_wait()
     if self.game_mode == common.Games.Swapper:
         Audio(
             'audio/Menu/Swapper-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.Tournament:
         Audio('audio/Menu/Tournament-instructions.wav'
               ).start_effect_and_wait()
     if self.game_mode == common.Games.FightClub:
         os.popen(
             'espeak -ven -p 70 -a 200 "Two players fight, the winner must defend thier title, the player with the highest score wins'
         )
         time.sleep(5)
コード例 #16
0
 def play_random_instructions(self):
     if self.game_mode == common.Games.JoustFFA:
         Audio('audio/Menu/FFA-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.JoustRandomTeams:
         Audio('audio/Menu/Teams-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.Traitor:
         Audio(
             'audio/Menu/Traitor-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.WereJoust:
         Audio('audio/Menu/werewolf-instructions.wav'
               ).start_effect_and_wait()
     if self.game_mode == common.Games.Zombies:
         Audio('audio/Menu/zombie-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.Commander:
         Audio('audio/Menu/commander-instructions.wav'
               ).start_effect_and_wait()
     if self.game_mode == common.Games.Ninja:
         Audio('audio/Menu/Ninjabomb-instructions.wav'
               ).start_effect_and_wait()
     if self.game_mode == common.Games.Swapper:
         Audio(
             'audio/Menu/Swapper-instructions.wav').start_effect_and_wait()
     if self.game_mode == common.Games.Tournament:
         Audio('audio/Menu/Tournament-instructions.wav'
               ).start_effect_and_wait()
コード例 #17
0
 def overdrive(self, team):
     Audio('audio/Commander/sounds/overdrive.wav').start_effect()
     if team == Team.alpha.value:
         self.alpha_overdrive.value = 1
         self.activated_overdrive[Team.alpha.value] = time.time() + 10
         Audio('audio/Commander/vox/' + self.voice +
               '/red overdrive.wav').start_effect()
     else:
         self.bravo_overdrive.value = 1
         self.activated_overdrive[Team.bravo.value] = time.time() + 10
         Audio('audio/Commander/vox/' + self.voice +
               '/blue overdrive.wav').start_effect()
コード例 #18
0
ファイル: tournament.py プロジェクト: etaiklein/JoustMania
    def __init__(self, moves, command_queue, ns, music, show_team_colors, music_speed, teams, dead_moves, force_move_colors, invincible_moves, num_teams, restart):

        self.command_queue = command_queue
        self.ns = ns

        self.sensitivity = self.ns.settings['sensitivity']
        self.play_audio = self.ns.settings['play_audio']

        self.move_serials = moves

        self.tracked_moves = {}
        self.dead_moves = dead_moves
        self.music_speed = music_speed
        self.music_speed.value = 1.5 # Value('d', 1.5)
        self.running = True
        self.force_move_colors = force_move_colors
        self.invince_moves = invincible_moves
        

        self.start_timer = time.time()
        self.audio_cue = 0
        self.num_dead = 0
        self.show_team_colors = show_team_colors 
        self.show_team_colors.value = 0 #Value('i', 0)
        self.teams = teams
        self.update_time = 0
        self.restart = restart
        
        #self.num_teams = math.ceil(len(moves)/2)
        self.num_teams = len(moves)
        num_teams.value = self.num_teams

        
        self.generate_random_teams(self.num_teams)

        self.tourney_list = self.generate_tourney_list(len(moves))
        fast_resample = False
        if self.play_audio:
            print("tourney list is " + str(self.tourney_list))

            self.start_beep = Audio('audio/Joust/sounds/start.wav')
            self.start_game = Audio('audio/Joust/sounds/start3.wav')
            self.explosion = Audio('audio/Joust/sounds/Explosion34.wav')
            
            end = False
            self.audio = music
        
        self.speed_up = True
        self.currently_changing = False
        self.game_end = False
        self.winning_moves = []
        self.game_loop()
コード例 #19
0
    def check_end_game(self):
        winning_team = -100
        team_win = True
        for move_serial, dead in self.dead_moves.items():
            #if we are alive
            if dead.value == 1:
                if winning_team == -100:
                    winning_team = self.get_real_team(self.teams[move_serial])
                elif self.get_real_team(
                        self.teams[move_serial]) != winning_team:
                    team_win = False
            if dead.value == 0:
                #This is to play the sound effect
                self.num_dead += 1
                dead.value = -1
                self.non_stop_deaths[move_serial] += 1
                if self.play_audio:
                    self.explosion.start_effect()
            if dead.value == 2:
                dead.value = 1
                if self.play_audio:
                    self.revive.start_effect()

        if self.game_mode == common.Games.NonStop:
            if self.audio_cue == 0 and time.time() > self.non_stop_time - 60:
                Audio('audio/Zombie/vox/' + self.voice +
                      '/1 minute.wav').start_effect()
                self.audio_cue += 1
            if self.audio_cue == 1 and time.time() > self.non_stop_time - 30:
                Audio('audio/Zombie/vox/' + self.voice +
                      '/30 seconds.wav').start_effect()
                self.audio_cue += 1
            if time.time() > self.non_stop_time:
                lowest_score = 100000
                for move, score in self.non_stop_deaths.items():
                    self.dead_moves[move].value = 0
                    if score == lowest_score:
                        self.winning_moves.append(move)
                    if score < lowest_score:
                        lowest_score = score
                        self.winning_moves = []
                        self.winning_moves.append(move)
                self.game_end = True

        elif team_win:
            self.update_status('ending', winning_team)
            if self.play_audio:
                self.end_game_sound(winning_team)
            for move_serial in self.teams.keys():
                if self.get_real_team(self.teams[move_serial]) == winning_team:
                    self.winning_moves.append(move_serial)
            self.game_end = True
コード例 #20
0
    def __init__(self, moves, speed, command_queue, status_ns, audio_toggle, music):
        global SLOW_MAX
        global SLOW_WARNING
        global FAST_MAX
        global FAST_WARNING
        
        SLOW_MAX = common.SLOW_MAX[speed]
        SLOW_WARNING = common.SLOW_WARNING[speed]
        FAST_MAX = common.FAST_MAX[speed]
        FAST_WARNING = common.FAST_WARNING[speed]
        
        self.audio_toggle = audio_toggle
        self.move_serials = moves
        self.tracked_moves = {}
        self.dead_moves = {}
        self.teams = {}
        self.music_speed = Value('d', 1)
        self.running = True
        self.force_move_colors = {}
        self.team_num = 2

        self.start_timer = time.time()
        self.audio_cue = 0

        self.move_opts = {}

        self.command_queue = command_queue
        self.status_ns = status_ns
        self.update_time = 0


        self.generate_random_teams(self.team_num)
        if self.audio_toggle:
##            music = 'audio/Joust/music/' + random.choice(os.listdir('audio/Joust/music'))

            self.start_beep = Audio('audio/Joust/sounds/start.wav')
            self.start_game = Audio('audio/Joust/sounds/start3.wav')
            self.explosion = Audio('audio/Joust/sounds/Explosion34.wav')
            fast_resample = False
            end = False
            try:
                self.audio = music
            except:
                print('no audio loaded')

        #self.change_time = self.get_change_time(speed_up = True)
        self.change_time = time.time() + 8
        self.speed_up = True
        self.currently_changing = False
        self.game_end = False
        self.winning_moves = []
        self.game_loop()
コード例 #21
0
ファイル: joust.py プロジェクト: shihyu/JoustMania
 def werewolf_audio_cue(self):
     if self.game_mode == common.Games.WereJoust.value:
         #print self.werewolf_timer - (time.time() - self.start_timer)
         if self.werewolf_timer - (time.time() - self.start_timer) <= 30 and self.audio_cue == 0:
             Audio('audio/Joust/sounds/30 werewolf.wav').start_effect()
             self.audio_cue = 1
         if self.werewolf_timer - (time.time() - self.start_timer) <= 10 and self.audio_cue == 1:
             Audio('audio/Joust/sounds/10 werewolf.wav').start_effect()
             self.audio_cue = 2
         if self.werewolf_timer - (time.time() - self.start_timer) <= 0 and self.audio_cue == 2:
             Audio('audio/Joust/sounds/werewolf reveal 2.wav').start_effect()
             self.reveal()
             self.audio_cue = 3
コード例 #22
0
 def choose_new_music(self):
     self.joust_music = Audio(
         random.choice(glob.glob("audio/Joust/music/*")), False)
     try:
         self.zombie_music = Audio(
             random.choice(glob.glob("audio/Zombie/music/*")), False)
     except Exception:
         self.zombie_music = Audio("", False, False)
     try:
         self.commander_music = Audio(
             random.choice(glob.glob("audio/Commander/music/*")), False)
     except Exception:
         self.commander_music = Audio("", False, False)
コード例 #23
0
 def audio_cue(self):
     if self.win_time - (time.time() - self.start_time) <= 10 and self.effect_cue <= 4:
         Audio('audio/Zombie/sound_effects/10 seconds left.wav').start_effect()
         self.effect_cue = 5
     elif self.win_time - (time.time() - self.start_time) <= 30 and self.effect_cue <= 3:
         Audio('audio/Zombie/sound_effects/30 seconds.wav').start_effect()
         self.effect_cue = 4
     elif self.win_time - (time.time() - self.start_time) <= 1*60 and self.effect_cue <= 2:
         Audio('audio/Zombie/sound_effects/1 minute.wav').start_effect()
         self.effect_cue = 3
     elif self.win_time - (time.time() - self.start_time) <= 3*60 and self.effect_cue <= 1:
         Audio('audio/Zombie/sound_effects/3 minutes.wav').start_effect()
         self.effect_cue = 2
コード例 #24
0
ファイル: joust.py プロジェクト: shihyu/JoustMania
    def __init__(self, game_mode, moves, teams):

        self.move_serials = moves
        self.game_mode = game_mode
        self.tracked_moves = {}
        self.dead_moves = {}
        self.music_speed = Value('d', 1.5)
        self.running = True
        self.force_move_colors = {}
        self.teams = teams
        self.team_num = 6
        self.game_mode = game_mode
        self.werewolf_timer = 35
        self.start_timer = time.time()
        self.audio_cue = 0
        self.num_dead = 0
        self.werewolf_reveal = Value('i', 2)
        if game_mode == common.Games.JoustFFA.value:
            self.team_num = len(moves)
        if game_mode == common.Games.JoustRandomTeams.value:
            #this should be 3 for smaller number of controllers
            self.team_num = 4
        if game_mode == common.Games.WereJoust.value:
            self.werewolf_reveal.value = 0
            self.team_num = 1
        if game_mode != common.Games.JoustTeams.value:
            self.generate_random_teams(self.team_num)

        if game_mode == common.Games.WereJoust.value:
            #were_num = int((len(moves)+2)/4)
            were_num = int((len(moves)*7)/16)
            if were_num <= 0:
                were_num = 1
            self.choose_werewolf(were_num)

        music = 'audio/Joust/music/' + random.choice(os.listdir('audio/Joust/music'))
        self.start_beep = Audio('audio/Joust/sounds/start.wav')
        self.start_game = Audio('audio/Joust/sounds/start3.wav')
        self.explosion = Audio('audio/Joust/sounds/Explosion34.wav')
        fast_resample = False
        end = False
        self.audio = Audio(music, end)
        #self.change_time = self.get_change_time(speed_up = True)
        self.change_time = time.time() + 8
        self.speed_up = True
        self.currently_changing = False
        self.game_end = False
        self.winning_moves = []
        
        
        self.game_loop()
コード例 #25
0
ファイル: piparty.py プロジェクト: MrAbodi/JoustMania
    def check_admin_controls(self):
        show_bat = False
        for move_opt in self.move_opts.values():
            if move_opt[Opts.selection.value] == Selections.show_battery.value and move_opt[Opts.holding.value] == Holding.holding.value:
                show_bat = True
        if show_bat:
            self.show_battery.value = 1
        else:
            self.show_battery.value = 0
        
        if self.admin_move:
            #you can't add custom teams mode to con mode, don't set colors
            admin_opt = self.move_opts[self.admin_move]

            #to play instructions or not
            if admin_opt[Opts.selection.value] == Selections.change_instructions.value:
                admin_opt[Opts.selection.value] = Selections.nothing.value
                self.instructions = not self.instructions
                if self.instructions:
                    Audio('audio/Menu/instructions_on.wav').start_effect()
                else:
                    Audio('audio/Menu/instructions_off.wav').start_effect()

            #change sensitivity
            if admin_opt[Opts.selection.value] == Selections.change_sensitivity.value:
                admin_opt[Opts.selection.value] = Selections.nothing.value
                self.sensitivity = (self.sensitivity + 1) %  SENSITIVITY_MODES
                if self.sensitivity == Sensitivity.slow.value:
                    Audio('audio/Menu/slow_sensitivity.wav').start_effect()
                elif self.sensitivity == Sensitivity.mid.value:
                    Audio('audio/Menu/mid_sensitivity.wav').start_effect()
                elif self.sensitivity == Sensitivity.fast.value:
                    Audio('audio/Menu/fast_sensitivity.wav').start_effect()
                
            #no admin colors in con custom teams mode
            if self.game_mode == common.Games.JoustTeams.value or self.game_mode == common.Games.Random.value:
                self.force_color[self.admin_move][0] = 0
                self.force_color[self.admin_move][1] = 0
                self.force_color[self.admin_move][2] = 0
            else:
                #if game is in con mode, admin is green, otherwise admin is red
                if self.game_mode in self.con_games:
                    self.force_color[self.admin_move][0] = 0
                    self.force_color[self.admin_move][1] = 200

                else:
                    self.force_color[self.admin_move][0] = 200
                    self.force_color[self.admin_move][1] = 0

                #add or remove game from con mode
                if admin_opt[Opts.selection.value] == Selections.add_game.value:
                    admin_opt[Opts.selection.value] = Selections.nothing.value
                    if self.game_mode not in self.con_games:
                        self.con_games.append(self.game_mode)
                        Audio('audio/Menu/game_on.wav').start_effect()
                    elif len(self.con_games) > 1:
                        self.con_games.remove(self.game_mode)
                        Audio('audio/Menu/game_off.wav').start_effect()
                    else:
                        Audio('audio/Menu/game_err.wav').start_effect()
コード例 #26
0
    def __init__(self, moves, command_queue, ns, music, bomb_color, game_start,
                 five_move_opts, dead_moves, force_move_colors, false_colors,
                 was_faked, rumble, music_speed, restart):

        self.command_queue = command_queue
        self.ns = ns

        self.play_audio = self.ns.settings['play_audio']
        self.move_serials = moves
        self.tracked_moves = {}
        self.dead_moves = dead_moves
        self.alive_moves = []
        self.teams = {}
        self.music_speed = music_speed
        self.music_speed.value = 1
        self.running = True
        self.force_move_colors = force_move_colors
        self.bomb_color = bomb_color
        for i in range(3):
            self.bomb_color[i] = 0
        self.start_timer = time.time()
        self.audio_cue = 0
        self.num_bombs = 2
        self.move_opts = five_move_opts
        self.false_colors = false_colors
        self.was_faked = was_faked
        self.rumble = rumble
        self.bomb_length = 5.0
        self.restart = restart

        self.game_start = game_start
        self.game_start.value = 0
        self.current_rand_holder = ''
        self.next_rand_holder = ''
        self.prev_rand_holder = ''

        self.update_time = 0

        if self.play_audio:
            self.start_beep = Audio('audio/Joust/sounds/start.wav')
            self.start_game = Audio('audio/Joust/sounds/start3.wav')
            self.explosion = Audio('audio/Joust/sounds/Explosion34.wav')
            self.fakedout = Audio('audio/Joust/sounds/Fakedout.wav')
            self.explosion40 = Audio('audio/Joust/sounds/Explosion40.wav')
            self.countered = Audio('audio/Joust/sounds/countered.wav')
            self.Fakecountered = Audio(
                'audio/Joust/sounds/FakedoutCounter.wav')
            self.explosiondeath = Audio(
                'audio/Joust/sounds/explosiondeath.wav')

            end = False
            try:
                self.audio = music
            except:
                print('no audio loaded')

        self.game_end = False

        self.game_loop()
コード例 #27
0
def big_update():
    Audio('audio/Menu/update_started.wav').start_effect_and_wait()
    current_hash = run_command(
        "sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git rev-parse HEAD'"
    ).strip()
    run_command(
        "sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git checkout master'")
    run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git pull'")
    run_command("sudo /home/pi/JoustMania/setup.sh")
    #it failed if it got this far
    time.sleep(3)
    run_command(
        "sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git checkout {}'".
        format(current_hash))
    Audio('audio/Menu/joustmania_failed.wav').start_effect_and_wait()
コード例 #28
0
ファイル: joust.py プロジェクト: MrAbodi/JoustMania
    def game_loop(self):
        self.track_moves()
        if self.game_mode == common.Games.WereJoust.value:
            self.werewolf_intro()
        self.werewolf_reveal.value = 1
        if self.game_mode == common.Games.JoustRandomTeams.value:
            Audio('audio/Joust/sounds/teams_form.wav').start_effect()
            self.show_team_colors.value = 1
            time.sleep(6)
        self.show_team_colors.value = 0
        self.count_down()
        self.change_time = time.time() + 6
        time.sleep(0.02)
        self.audio.start_audio_loop()
        time.sleep(0.8)
        if self.game_mode == common.Games.WereJoust.value:
            self.music_speed.value = SLOW_MUSIC_SPEED
            self.audio.change_ratio(self.music_speed.value)
            self.speed_up = False

        while self.running:
            if self.game_mode != common.Games.WereJoust.value:
                self.check_music_speed()
            self.check_end_game()
            self.werewolf_audio_cue()
            if self.game_end:
                self.end_game()

        self.stop_tracking_moves()
コード例 #29
0
ファイル: zombie.py プロジェクト: etaiklein/JoustMania
    def __init__(self, cont_alive, command_queue, ns, music, restart,
                 zombie_opts):

        self.command_queue = command_queue
        self.ns = ns

        self.sensitivity = self.ns.settings['sensitivity']
        self.play_audio = self.ns.settings['play_audio']

        self.music = music
        self.restart = restart

        self.update_time = 0
        self.humans = []
        self.alive_zombies = []
        self.dead_zombies = {}
        self.controller_opts = zombie_opts
        self.controllers_alive = cont_alive
        self.win_time = ((len(self.controllers_alive) * 3) / 16) * 60
        if self.win_time <= 0:
            self.win_time = 60
        self.start_time = time.time()
        if self.play_audio:
            self.pickup = Audio('audio/Zombie/sound_effects/pickup.wav')
        self.effect_cue = 0

        self.kill_game = False
        self.Start()
コード例 #30
0
    def check_start_game(self):
        #if self.game_mode == common.Games.Random:
        self.exclude_out_moves()
        start_game = True
        for serial in self.move_opts.keys():
            #on means off here
            if self.out_moves[serial] == Alive.on.value and self.move_opts[
                    serial][Opts.random_start.value] == Alive.on.value:
                start_game = False
            if self.move_opts[serial][
                    Opts.random_start.
                    value] == Alive.off.value and serial not in self.random_added:
                self.random_added.append(serial)
                if self.ns.settings['play_audio']:
                    Audio('audio/Joust/sounds/start.wav').start_effect()

        if start_game:
            if self.game_mode == common.Games.Random:
                self.start_game(random_mode=True)
            else:
                self.start_game()

    #else:
    #    if self.ns.settings['move_can_be_admin']:
    #        for move_opt in self.move_opts.values():
    #            if move_opt[Opts.selection.value] == Selections.start_game.value:
    #                self.start_game()
        if self.command_from_web == 'startgame':
            self.command_from_web = ''
            self.start_game()