本文整理汇总了Python中group.Group.draw方法的典型用法代码示例。如果您正苦于以下问题:Python Group.draw方法的具体用法?Python Group.draw怎么用?Python Group.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.Group
的用法示例。
在下文中一共展示了Group.draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import draw [as 别名]
class Game:
def __init__(self, world, datadir, configdir):
self.world = world
self.datadir = datadir
self.configdir = configdir
self.enemies = []
self.stage = Stage(self)
self.sprites = Group(self.stage)
self.screen = world.screen
# Visor de energia para el enemigo
self._create_player()
self.energy = Energy(10, 10, 100, 10)
self.energy.set_model(self.player.id)
self.stage.player = self.player
self.stage.load_level(1)
if VISIBLE_DEBUG:
# Visor de rendimiento
self.text = Text(world.font, world.fps, "FPS: %d")
def _create_player(self):
control = Control(0, self.configdir)
self.player = Player(self, control, self.sprites, self.datadir)
shadow_player = Shadow(self.player, self.datadir)
self.sprites.add([self.player, shadow_player])
def update(self):
self.stage.update()
self.sprites.update()
self.energy.update()
if VISIBLE_DEBUG:
self.text.update()
if DEBUG:
b1, b2, b3 = pygame.mouse.get_pressed()
if b1:
self.stage.do_camera_effect()
elif b2:
self.stage.do_camera_effect(10)
elif b3:
self.world.fps.slow()
def draw(self):
self.stage.draw(self.screen)
self.sprites.draw(self.screen)
self.screen.blit(self.energy.image, self.energy.rect)
if VISIBLE_DEBUG:
self.screen.blit(self.text.image, self.text.rect)
pygame.display.flip()
示例2: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import draw [as 别名]
class About:
"Muestra información acerca los desarrolladores y losersjuegos."
def __init__(self, world):
self.world = world
self.sprites = Group()
self.background = load_image("about.png", "scenes")
def update(self):
pass
def draw(self, screen):
screen.blit(self.background, (0, 0))
self.sprites.draw(screen)
pygame.display.flip()
def on_return_to_main_menu(self):
import scenes
self.world.change_state(scenes.mainmenu.MainMenu(self.world))
def handle_event(self, event):
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.on_return_to_main_menu()