Esempio n. 1
0
 def init_player_data(self):
     
     for player_position in self.player_type_dictionary.keys():
         if self.player_type_dictionary[player_position] == PlayerTypes.BOT:
             self.player_dictionary[player_position] = aiplayer.Bot(
                 (0, 0),
                 player_position
             )
         elif self.player_type_dictionary[player_position] == PlayerTypes.HUMAN:
             self.player_dictionary[player_position] = humanplayer.HumanPlayer(
                 (0, 0),
                 player_position
             )
         else:
             raise Exception(
                 "No player type set for player position: " + str(player_position)
             )
         
         
         self.player_key_handlers[player_position] = KeyToCommandTypeConverter(
             dict([(entry[1], entry[0]) 
             for entry in get_controls()[player_position].iteritems()])
         )
     
     
     player1 = self.player_dictionary[PlayerPositions.PLAYER1]
     player1.direction = PlayerStates.FACING_RIGHT
     player1.init_state()
     player1.model.move_model((400, 967))
     
     
     player2 = self.player_dictionary[PlayerPositions.PLAYER2]
     player2.direction = PlayerStates.FACING_LEFT
     player2.init_state()
     player2.model.move_model((1200, 967))
 def add_player(self, player_data):
     player = create_player(player_data)
     player_position = player_data.player_position
     self.player_positions.append(player_position)
     self.player_dictionary[player_position] = player
     self.player_key_handlers[player_position] = KeyToCommandTypeConverter(
         dict([(entry[1], entry[0]) 
         for entry in get_controls()[player_position].iteritems()])
     )
     self.player_event_handlers[player_position] = versusmode.EventRegistry()
     self.player_type_dictionary[player_position] = player_data.player_type
     self.player_health_bars[player_position] = PlayerHealth(
         player_data.moveset.name, 
         player_position
     )
     self.attack_lists[player_position] = AttackList(
         player_data.moveset,
         (
             int((gamestate._WIDTH / 2) - PAUSE_MENU_WIDTH),
             int((gamestate._HEIGHT / 2) - (PAUSE_MENU_HEIGHT / 2))
         )
     )