本文整理汇总了Python中wizard.Wizard.blitme方法的典型用法代码示例。如果您正苦于以下问题:Python Wizard.blitme方法的具体用法?Python Wizard.blitme怎么用?Python Wizard.blitme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wizard.Wizard
的用法示例。
在下文中一共展示了Wizard.blitme方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WvmSpritesList
# 需要导入模块: from wizard import Wizard [as 别名]
# 或者: from wizard.Wizard import blitme [as 别名]
class WvmSpritesList():
"""A class listing all the Sprites of the game."""
def __init__(self, config, screen):
"""Initialize the sprite list."""
self.config = config
self.screen = screen
#initialize the sprites
self.wiz = Wizard(config, self)
self.monsters = Group()
self.missiles = Group()
def update_all(self):
"""Update the positions of all sprites."""
self.update_missiles()
self.wiz.update()
self.monsters.update()
def update_missiles(self):
"""update magic missiles positions"""
self.missiles.update()
# remove the missiles that have left the screen
for mi in self.missiles.copy():
if mi.rect.left >= self.screen.get_rect().right:
self.missiles.remove(mi)
def draw(self):
self.screen.fill(self.config.bg_color)
for mi in self.missiles:
mi.draw_missile()
self.wiz.blitme()
for mo in self.monsters:
mo.blitme()
def fire_missile(self):
"""Fire a missile if limit not reached yet."""
if len(self.missiles) < self.wiz.magic_missile_allowed:
self.missiles.add(MagicMissile(self.config, self))
def create_monster(self):
"""Create a new monster and place it randomly at the right."""
monster=Monster(self.config, self)
#TODO move the monster
self.monsters.add(monster)