本文整理汇总了Python中hero.Hero.twist_left方法的典型用法代码示例。如果您正苦于以下问题:Python Hero.twist_left方法的具体用法?Python Hero.twist_left怎么用?Python Hero.twist_left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hero.Hero
的用法示例。
在下文中一共展示了Hero.twist_left方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Level
# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import twist_left [as 别名]
#.........这里部分代码省略.........
else:
def f(screen):
def g(screen):
return HighScores(self.screen, self.father, self.total_points)
music.play_music(WINMUSIC)
return Visual(screen,utils.load_image(WIN),-1,g)
return f
elif self.energy_bar.energy_percent <= 0:
def f(screen):
def g(screen):
return HighScores(self.screen, self.father, self.total_points)
music.play_gameover()
return Visual(screen, [utils.load_image(GAMEOVER)], [3], g)
return f
def update(self):
if self.level in(4,5):
self.snow_slim.update()
self.energy_bar.update(self.tics)
self.level_time.update(self.tics)
self.bm.update()
self.mm.gen(self.tics)
self.mm.move(self.tics)
if self.level in(4,5):
self.snow_fat.update()
#Blood Explotion
self.explotion.update(self.tics, self.screen)
#Verify collision
if self.mm.is_fitting(self.hero, self.tics):
self.explotion.boom(self.hero.get_center())
self.total_points += 1
self.pointsCounter.update(self.total_points)
self.levelIndicator.update(self.level)
def draw(self):
self.snow_slim.draw(self.screen)
self.bm.draw(self.screen)
self.mm.draw(self.screen)
self.hero.draw(self.screen)
self.snow_fat.draw(self.screen)
self.gadgets.draw(self.screen)
def control(self, event):
if event.type == QUIT:
sys.exit(0)
if event.type == KEYDOWN:
if event.key == K_DOWN:
self.control_down = 0
if event.key == K_UP:
self.control_up = 0
if event.key == K_RIGHT:
self.control_right = 0
if event.key == K_LEFT:
self.control_left = 0
if event.key in(K_SPACE, K_s):
self.hero.twist_right()
music.play_scream()
if event.key == K_a:
self.hero.twist_left()
music.play_scream()
if event.key == K_ESCAPE:
pygame.mixer.music.set_volume(0.5)
mem = Menu(self.screen, self.options, "Do you want to quit?").loop()
pygame.mixer.music.set_volume(1.0)
if mem == self.father:
music.stop_music()
self.exit = True
if event.type == KEYUP:
if event.key == K_DOWN:
self.control_down = -1
if event.key == K_UP:
self.control_up = -1
if event.key == K_RIGHT:
self.control_right = -1
if event.key == K_LEFT:
self.control_left = -1
def finish(self):
if self.level_time.seconds == 0 or self.energy_bar.energy_percent <= 0 or self.exit:
return True
return False