本文整理汇总了Python中level.Level.portals[(x,y)]方法的典型用法代码示例。如果您正苦于以下问题:Python Level.portals[(x,y)]方法的具体用法?Python Level.portals[(x,y)]怎么用?Python Level.portals[(x,y)]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类level.Level
的用法示例。
在下文中一共展示了Level.portals[(x,y)]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_shop
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import portals[(x,y)] [as 别名]
shop_img = spr.SHOP_WEAPONS
shop_name = "weapon shop"
elif shop_type == 2:
# Armor shop
shop_items = default_items.armors
shop_img = spr.SHOP_ARMOR
shop_name = "armor shop"
new_shop = generate_shop(16, 16, shop_items)
shop.append(new_shop)
# add portal to shop from town
town.add_item((x,y), Item(shop_img, name=shop_name, holdable=False))
town.portals[(x,y)] = Portal(new_shop, 1, 1, name="the "+shop_name)
# add portal to town from shop
new_shop.add_item((1,1), Item(spr.DOOR, holdable=False))
new_shop.portals[(1,1)] = Portal(town, x, y, name="the town")
# Add portals to dungeon
for i in xrange(WELL_DEPTH):
mr = well[i].get_main_region()
to_up, to_down = random.sample(mr, 2)
if i == 0:
well[i].add_item(to_up, Item(spr.ROPE_UP, holdable=False))
well[i].add_item(to_down, Item(spr.WELL, holdable=False))
well[i].portals[to_up] = Portal(town, 12, 12)
town.portals[(12,12)] = Portal(well[0], *to_up, name="the well of doom")