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


Python World.tile_exists方法代码示例

本文整理汇总了Python中World.tile_exists方法的典型用法代码示例。如果您正苦于以下问题:Python World.tile_exists方法的具体用法?Python World.tile_exists怎么用?Python World.tile_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在World的用法示例。


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

示例1: move

# 需要导入模块: import World [as 别名]
# 或者: from World import tile_exists [as 别名]
	def move(self, dx, dy):
		if World.tile_exists(self.location_x + dx, self.location_y + dy):
                        self.location_x += dx
                        self.location_y += dy
                        print(World.tile_exists(self.location_x, self.location_y).intro_text())
                else:
                        print("You bump into an invisible wall.")
开发者ID:Captain-Eli,项目名称:Cranberries,代码行数:9,代码来源:Player.py

示例2: adjacent_moves

# 需要导入模块: import World [as 别名]
# 或者: from World import tile_exists [as 别名]
	def adjacent_moves(self):
		"""Returns all move actions for adjacent tiles."""
		moves =[]
		if World.tile_exists(self.x + 1, self.y):
			moves.append(Actions.MoveEast())
		if World.tile_exists(self.x - 1, self.y):
			moves.append(Actions.MoveWest())
		if World.tile_exists(self.x, self.y + 1):
			moves.append(Actions.MoveNorth())
		if World.tile_exists(self.x, self.y - 1):
			moves.append(Actions.MoveSouth())
		return moves
开发者ID:IceProdigyHaku,项目名称:Adventure,代码行数:14,代码来源:tiles.py

示例3: play

# 需要导入模块: import World [as 别名]
# 或者: from World import tile_exists [as 别名]
def play():
    World.load_tiles()
    gamePlayer = Player()
    while gamePlayer.is_alive() and not gamePlayer.victory:
        room = World.tile_exists(gamePlayer.location_x, gamePlayer.location_y)
        room.modify_Player(gamePlayer)
        if gamePlayer.is_alive() and not gamePlayer.victory:
            print   ("What will you do?:\n")
            available_actions = room.available_Actions()
            for action in available_actions:
                print   (action)
            Action_input = raw_input('Action: ')
            for checkAction in available_actions:
                if Action_input == checkAction.hotkey:
                        gamePlayer.do_action(checkAction, **checkAction.kwargs)
                        break
开发者ID:Captain-Eli,项目名称:Cranberries,代码行数:18,代码来源:Game.py

示例4: play

# 需要导入模块: import World [as 别名]
# 或者: from World import tile_exists [as 别名]
def play():
	World.load_tiles()
	player = Player()
	#These lines load the starting room and display the text
	while player.is_alive() and not player.victory:
		room = World.tile_exists(player.location_x, player.location_y)
		room.modify_Player(player)
		#check again since the room could have changed the player's state
		print("choose an action:\n")
		available_actions = room.available_actions()
		for action in available_actions:
			print(action)
		action_input = input('action: ')
		for action in available_actions:
			if action_input == action.hotkey:
				player.do_action(action, **action.kwargs)
				break
开发者ID:IceProdigyHaku,项目名称:Adventure-Tutorial,代码行数:19,代码来源:Game.py

示例5: move

# 需要导入模块: import World [as 别名]
# 或者: from World import tile_exists [as 别名]
	def move(self, dx, dy):
		self.location_x += dx
		self.location_y += dy
		print(World.tile_exists(self.location_x, self.location_y).intro_text())
开发者ID:IceProdigyHaku,项目名称:Adventure-Tutorial,代码行数:6,代码来源:Player.py


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