本文整理汇总了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.")
示例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
示例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
示例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
示例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())