当前位置: 首页>>代码示例>>Python>>正文


Python Player类代码示例

本文整理汇总了Python中Player的典型用法代码示例。如果您正苦于以下问题:Python Player类的具体用法?Python Player怎么用?Python Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: throwItem

def throwItem(position,index): #Jette un objet
	global throw
	throw = 0
	Map.addItem(position,Player.getItem(index))
	descript = "You throw " + Player.getItemName(index) + " away."
	Player.removeItem(index)
	return descript
开发者ID:ForgetfulMuffin,项目名称:The-Shades,代码行数:7,代码来源:GameEN.py

示例2: player_start

def player_start(cave_list, spawn_list):  
    for item in cave_list:
        if item.get_pit() == False and item.get_bat() == False and item.get_wumpus() == False:
            spawn_list.append(item)
    
    spawn_room = random.choice(spawn_list)
    Player.set_room(spawn_room.get_value())
开发者ID:Jds95,项目名称:ciss465-HTW,代码行数:7,代码来源:htw_game.py

示例3: __init__

	def __init__(self, file_path):
		super(Scene, self).__init__()

		pygame.mixer.init(44100, -16, 4, 2048)
		self.position = ['goalkeeper', 'defender', 'midfielder', 'attacker']
		self.all_object_list = pygame.sprite.LayeredUpdates()
		self.selection_circle = [] # Prototype
		self.left_player = Player() # Prototype
		self.right_player = Player() # Prototype
		self.teams = collections.defaultdict(dict)
		self.field = Object()
		self.field_border = Object()
		self.goal = []
		self.ball = Ball()
		self.hud = HUD()
		self.goal_image = EffectObject()
		self.formation = {Team_side.LEFT: [1, 4, 3, 3], Team_side.RIGHT: [1, 4, 4, 2]}
		self.sound_list = dict()

		# Game config
		self.game_mode = Game_mode.PvP
		self.P1_controlled_team = Team_side.LEFT
		self.P1_controlled_position = 'midfielder'
		self.P2_controlled_team = Team_side.RIGHT
		self.P2_controlled_position = 'midfielder'

		# Load scene's resources
		self.read_scene(file_path)
开发者ID:tr1et,项目名称:pygame-table-football,代码行数:28,代码来源:Scene.py

示例4: __init__

   def __init__(self, screen, snake_sleep, quit_page, game_type):
      self.screen = screen
      self.snake_sleep = snake_sleep
      self.quit_page = quit_page
      self.draw_area = DrawArea(screen)
      self.players = []

      self.map0 = {  curses.KEY_UP : 3,
            curses.KEY_LEFT : 4,
            curses.KEY_DOWN : 1,
            curses.KEY_RIGHT : 2}
      self.player0 = Player(self.draw_area.width / 4,self.draw_area.height / 2, 3, 5, self.map0,self.draw_area,True)
      self.player0.add_to_obstacles(self.player0.snake)
      self.egg = Egg(self.draw_area, 9, 9)
      self.player0.add_to_food(self.egg)


      if game_type != 1:
         self.map1 = {  ord('w') : 3,
               ord('a') : 4,
               ord('s') : 1,
               ord('d') : 2}
         self.player1 = Player(9, 9, 1, 5, self.map1, self.draw_area,False)
         self.player1.add_to_obstacles(self.player0.snake)
         self.player1.add_to_obstacles(self.player1.snake)
         self.player1.add_to_food(self.egg)
         self.player0.add_to_obstacles(self.player1.snake)
      self.game_type = game_type
开发者ID:harveywilliams56,项目名称:harvey_snake,代码行数:28,代码来源:GamingPage.py

示例5: throwItem

def throwItem(position,index): #Jette un objet
	global throw
	throw = 0
	Map.addItem(position,Player.getItem(index))
	descript = "Vous jetez " + Player.getItemName(index)
	Player.removeItem(index)
	return descript
开发者ID:ForgetfulMuffin,项目名称:The-Shades,代码行数:7,代码来源:GameFR.py

示例6: main

def main():
	global flag
	global count
	screen=Screen()
	i=25
	j=1
	pm=Player(i,j)
	screen.printpm(i,j,'P')
	#flag=0
	#screen.printScreen()

	os.system("clear")
	screen.genCoins()
	screen.printScreen()
	while(1):
		print "Enter Move  :",
		ch=getchar()
		if(ch=='q'):
			break
		pm.move(ch,screen)

		print ""
		os.system("clear")
		screen.printScreen()
		print "Score :",
		print screen.getScore()
		if(screen.getflag1()==1):
			break
	print ""
	print "Game Over!!! Score is:",
	print screen.getScore()
开发者ID:anirudhdahiya9,项目名称:Open-data-projecy,代码行数:31,代码来源:main.py

示例7: minimaxMove

 def minimaxMove(self, board, ply):
     """ Choose the best minimax move.  Returns (score, move) """
     move = -1
     score = -INFINITY
     turn = self
     for m in board.legalMoves(self):
         #for each legal move
         if ply == 0:
             #if we're at ply 0, we need to call our eval function & return
             return (self.score(board), m)
         if board.gameOver():
             return (-1, -1)  # Can't make a move, the game is over
         nb = deepcopy(board)
         #make a new board
         nb.makeMove(self, m)
         #try the move
         opp = Player(self.opp, self.type, self.ply)
         s = opp.minValue(nb, ply-1, turn)
         #and see what the opponent would do next
         if s > score:
             #if the result is better than our best score so far, save that move,score
             move = m
             score = s
     #return the best score and move so far
     return score, move
开发者ID:tenaciousj,项目名称:NUAssignments,代码行数:25,代码来源:TicTacToe.py

示例8: alphaBetaMove

    def alphaBetaMove(self, board, ply):
        """ Choose a move with alpha beta pruning.  Returns (score, move) """
        move = -1
        score = -INFINITY
        turn = self
        alpha = -INFINITY
        beta = INFINITY
        for m in board.legalMoves(self):
            #for each legal move
            if ply == 0:
                #if we're at ply 0, we need to call our eval function & return
                return (self.score(board), m)
            if board.gameOver():
                return (-1, -1)  # Can't make a move, the game is over
            nb = deepcopy(board)
            #make a new board
            nb.makeMove(self, m)
            #try the move
            opp = Player(self.opp, self.type, self.ply)
            s = opp.minValueAB(nb, ply-1, alpha, beta, turn)
            #and see what the opponent would do next
            if s > score:
                #if the result is better than our best score so far, save that move,score
                move = m
                score = s
        #return the best score and move so far
        return score, move

        
        print "Alpha Beta Move not yet implemented"
        #returns the score adn the associated moved
        return (-1,1)
开发者ID:tenaciousj,项目名称:NUAssignments,代码行数:32,代码来源:TicTacToe.py

示例9: listener

 def listener(self, client, packet):
     self.serverSocket.serverLock()
     if isinstance(packet, Packets.PlayerInfoPacket):
         if packet.getHealth() > 0:
             if client not in self.players:
                 player = Player(
                     self.getGame(),
                     color=Color(
                         random.randint(127, 255),
                         random.randint(127, 255),
                         random.randint(127, 255)
                     )
                 )
                 player.setPlayerId(self.pid)
                 player.setPlayerName(packet.getPlayerName())
                 self.pid += 1
                 self.players[client] = player
             else:
                 player = self.players[client]
             player.setPosition(packet.getPosition())
             player.setAngle(packet.getAngle())
         self.packetCount += 1
     elif isinstance(packet, Packets.PlayerGunPacket):
         player = self.players[client]
         bullets = player.shoot()
         for bullet in bullets:
             bullet.setBulletId(self.bid)
             self.bid += 1
         self.bullets += bullets
         self.packetCount += 1
     elif packet is not None:
         self.packetCount += 1
         print("Packet received (type " + str(packet) + ")")
     self.serverSocket.serverUnlock()
开发者ID:spywhere,项目名称:Pew-Pew,代码行数:34,代码来源:GameServerScene.py

示例10: update

    def update(self):
        self.move()

        if self.health <= 0:
            all_sprites_list.remove(self)

        Player.update(self)
开发者ID:elston-jja,项目名称:cpt,代码行数:7,代码来源:Enemy.py

示例11: teleport_check

def teleport_check(Player, cave_list):
    copy_cave = cave_list[:]
    for item in cave_list:
        if item.get_bat() == True:
            while item.get_value() == Player.get_room():
                copy_cave.remove(item)
                random_cave = random.choice(copy_cave)
                Player.set_room(random_cave.get_value())
开发者ID:Jds95,项目名称:ciss465-HTW,代码行数:8,代码来源:htw_game.py

示例12: quit

 def quit(self):
     # evilynux - self.audio.close() crashes when we attempt to restart
     if not self.restartRequested:
         self.audio.close()
     Player.savePlayers()
     for t in list(self.tasks + self.frameTasks):
         self.removeTask(t)
     self.running = False
开发者ID:chk666,项目名称:fofix,代码行数:8,代码来源:GameEngine.py

示例13: deleteCharacter

 def deleteCharacter(self):
     tsYes = _("Yes")
     q = Dialogs.chooseItem(self.engine, [tsYes, _("No")], _("Are you sure you want to delete this player?"))
     if q == tsYes:
         if self.player:
             Player.deletePlayer(self.player)
         self.engine.view.popLayer(self)
         self.engine.input.removeKeyListener(self)
开发者ID:Richardgriff,项目名称:fofix,代码行数:8,代码来源:Lobby.py

示例14: test_playerAttack

	def test_playerAttack(self):
		arni = Player("Arni")
		villi = Player("Villi")
		pre = Presets()
		emptyArray = []
		arni.mainCard = pre.gc("Charizard")
		villi.mainCard = pre.gc("Bulbasaur")
		self.assertTrue(isinstance(arni.attack(2, villi, emptyArray), bool))
开发者ID:ivanbjarni,项目名称:PokeDevs,代码行数:8,代码来源:test_kapall.py

示例15: registerPlayer

def registerPlayer(name, tournament_id):
    """
        Adds a player to the tournament database.
        Args:
            name =  the player's full name (need not be unique).
            tournament =  tournament id where player is to be added to
    """

    Player.addPlayer(name, tournament_id)
开发者ID:arkiv2,项目名称:tournament-results,代码行数:9,代码来源:tournament.py


注:本文中的Player类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。