本文整理汇总了Python中dungeon.Dungeon.load_map_from_file方法的典型用法代码示例。如果您正苦于以下问题:Python Dungeon.load_map_from_file方法的具体用法?Python Dungeon.load_map_from_file怎么用?Python Dungeon.load_map_from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dungeon.Dungeon
的用法示例。
在下文中一共展示了Dungeon.load_map_from_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Hero
# 需要导入模块: from dungeon import Dungeon [as 别名]
# 或者: from dungeon.Dungeon import load_map_from_file [as 别名]
from hero import Hero
from dungeon import Dungeon
from weapon import Weapon
if __name__ == '__main__':
hero = Hero("Ragnar", "Lothbrok", 20, 100, 2)
knife = Weapon("Knife", 50)
hero.weapon = knife
dungeon = Dungeon.load_map_from_file("level1.txt")
print("Hello, You are in our game! Exit from dungeon, marry to princess!")
print("Move by typing 'l,L(left)', 'r,R(right)', 'u,U(up)', 'd,D(down)'")
print("Attack enemies with f(fight).")
print("GO GO GO HERO!")
print()
dungeon.spawn(hero)
is_loaded_second_map = False
while hero.is_alive() or dungeon.spawn(hero):
dungeon.print_map()
move = input("Choose your move: ")
is_there_gate = False
if move == "W" or move == "w":
is_there_gate = dungeon.move_hero("u")
elif move == "A" or move == "a":
is_there_gate = dungeon.move_hero("l")