本文整理汇总了Python中hero.Hero.right方法的典型用法代码示例。如果您正苦于以下问题:Python Hero.right方法的具体用法?Python Hero.right怎么用?Python Hero.right使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hero.Hero
的用法示例。
在下文中一共展示了Hero.right方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Level
# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import right [as 别名]
class Level(object):
'''TwistedMold level'''
def __init__(self, screen, father, level, total_points):
self.screen = screen
self.father = father
self.level = level
self.background = utils.load_image(levels[level]['background'])
#parameters
self.energy_leap = levels[level]['energy_leap']
self.mold_density = levels[level]['mold_density']
self.mold_velocity = levels[level]['mold_velocity']
self.max_time = levels[level]['max_time']
#menu control
self.options = [("Yes", self.father),("No", None)]
self.exit = False
#Create the game clock
self.clock = pygame.time.Clock()
self.mm = MoldsManager(self.mold_density, self.mold_velocity)
self.bm = BottleManager(*levels[self.level]['bottle_density'])
self.bm.mm = self.mm
self.total_points = total_points
self.pointsCounter = Points(self.total_points)
self.levelIndicator = LevelIndicator(self.level)
self.mm.level = self
self.tics = 0
self.snow_slim = pygame.sprite.Group()
self.snow_fat = pygame.sprite.Group()
for x in range(75):
sprite = Wheather(1,2)
self.snow_slim.add(sprite)
for x in range(75):
sprite = Wheather(3,5)
self.snow_fat.add(sprite)
self.energy_bar = EnergyBar(self.energy_leap)
self.bm.energy_bar = self.energy_bar
self.mm.energy_bar = self.energy_bar
self.level_time = LevelTime(self.max_time)
self.gadgets = pygame.sprite.RenderUpdates()
self.gadgets.add(self.pointsCounter)
self.gadgets.add(self.energy_bar)
self.gadgets.add(self.level_time)
self.gadgets.add(self.levelIndicator)
self.hero = Hero()
self.bm.hero=self.hero
self.mm.hero=self.hero
self.explotion = Explotion()
self.control_down = -1
self.control_up = -1
self.control_left = -1
self.control_right = -1
self.control_tiempo = 5
self.next_scream = random.randrange(400,500)
#Show level image
Visual(self.screen, [utils.load_image(levels[self.level]['img'])], [2], None).loop()
def loop(self):
music.play_music(PLAYMUSIC)
while not self.finish():
self.tics += 1
if not self.next_scream:
music.play_random_scream()
self.next_scream = random.randrange(400,500)
else:
self.next_scream -= 1
self.screen.blit(self.background, (-(self.tics % 700),0))
self.update()
self.draw()
#Control
for event in pygame.event.get():
self.control(event)
self.clock.tick(CLOCK_TICS)
if self.control_down == 0: self.hero.down()
if self.control_up == 0: self.hero.up()
if self.control_right == 0: self.hero.right()
if self.control_left == 0: self.hero.left()
if self.control_down >= 0:
#.........这里部分代码省略.........