本文整理汇总了Python中spider.Spider.getSprite方法的典型用法代码示例。如果您正苦于以下问题:Python Spider.getSprite方法的具体用法?Python Spider.getSprite怎么用?Python Spider.getSprite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spider.Spider
的用法示例。
在下文中一共展示了Spider.getSprite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import getSprite [as 别名]
def __init__(self, _engine):
super(Scene, self).__init__(_engine)
self.side = utils.loadImage('data/gfx/side.png')
self._background = pygame.Surface((self._resx, self._resy))
self._background.blit(self.side, (self._resx - 232, self._resy - 1500))
self.surface = self._background.copy()
self._actual = []
self._level = utils.loadLevel('data/level.dat')
self._map = Map(_engine, self, self._level)
self._minimap = Minimap(_engine, self._map)
self._cursor = Cursor(_engine, self._map)
self._creatureLayer = CreatureLayer(self._map, self._cursor) # Warstwa potworów
self._map.addLayer('Creatures', 2, self._creatureLayer)
self._map.addLayer('Missiles', 3, MissilesLayer(self._map)) # Warstwa pocisków(strzał, kuli ognia itp.)
self._shadow = ShadowLayer(self._map)
self._map.addLayer('Shadow', 5, self._shadow) # Mgła wojny
self._monsters = []
self._freeobjects = pygame.sprite.Group() # Wolne obiekty na scenie
_counter = 0
_start = 0
# szukanie bohatera w lochu
for l, storey in enumerate(self._level):
for row in storey:
for cell in row:
if cell.getModifier() & field.MODIFIER_HERO:
self._hero = hero.Hero(self._map, cell.getGrid() + (l,))
self._hero.move((0, 0, 0))
self._map.switchStorey(l)
_start = l
self._creatureLayer.add('hero', self._hero.getSprite(self._creatureLayer, 'hero'))
break
# szukanie potworów
for l, storey in enumerate(self._level):
for row in storey:
for cell in row:
if cell.getModifier() & field.MODIFIER_SPIDER:
_monster = Spider(self._map, cell.getGrid() + (l,))
self._monsters.append(('spider', _monster))
if l == _start:
self._creatureLayer.add('spider_' + str(_counter), _monster.getSprite(self._creatureLayer, 'spider_' + str(_counter)))
self._actual.append(('spider_' + str(_counter), _monster))
_monster.move((0, 0, 0))
_counter += 1
elif cell.getModifier() & field.MODIFIER_SKELETON:
_monster = Skeleton(self._map, cell.getGrid() + (l,))
self._monsters.append(('skeleton', _monster))
if l == _start:
self._creatureLayer.add('skeleton_' + str(_counter), _monster.getSprite(self._creatureLayer, 'skeleton_' + str(_counter)))
self._actual.append(('skeleton_' + str(_counter), _monster))
_monster.move((0, 0, 0))
_counter += 1
elif cell.getModifier() & field.MODIFIER_MAGE:
_monster = Mage(self._map, cell.getGrid() + (l,))
self._monsters.append(('mage', _monster))
if l == _start:
self._creatureLayer.add('mage_' + str(_counter), _monster.getSprite(self._creatureLayer, 'mage_' + str(_counter)))
self._actual.append(('mage_' + str(_counter), _monster))
_monster.move((0, 0, 0))
_counter += 1
elif cell.getModifier() & field.MODIFIER_TROLL:
_monster = Troll(self._map, cell.getGrid() + (l,))
self._monsters.append(('troll', _monster))
if l == _start:
self._creatureLayer.add('troll_' + str(_counter), _monster.getSprite(self._creatureLayer, 'troll_' + str(_counter)))
self._actual.append(('troll_' + str(_counter), _monster))
_monster.move((0, 0, 0))
_counter += 1
if not self._hero:
raise Exception('Brak bohatera w lochu!?')
self._statusbar = StatusBar(_engine, self._hero) # pasek życia/many itp. / statusu
self.inventory = Inventory(_engine, self._hero, self._hero.inventory, self._freeobjects)
self.chestitems = ChestItems(_engine, self._hero, self._freeobjects)
self._submodules = (self._map, self._minimap, self._statusbar, self.inventory, self.chestitems, self._cursor)
self._play = True
self._refresh = True