本文整理汇总了Python中hud.Hud.update_score方法的典型用法代码示例。如果您正苦于以下问题:Python Hud.update_score方法的具体用法?Python Hud.update_score怎么用?Python Hud.update_score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hud.Hud
的用法示例。
在下文中一共展示了Hud.update_score方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Main
# 需要导入模块: from hud import Hud [as 别名]
# 或者: from hud.Hud import update_score [as 别名]
#.........这里部分代码省略.........
temp_pos = self.menu_pos + pos
if temp_pos < 0:
self.menu_pos = 0
elif temp_pos > 2:
self.menu_pos = 2
else:
self.menu_pos = temp_pos
def check_collision_spiders(self):
for i in reversed(xrange(len(self.spiders))):
# collision with deadline and player
spider = self.spiders[i]
if spider.rect.top < self.deadline or (spider.rect.colliderect(self.player) and self.player.alive()):
self.player.hit()
self.spiders[i].get_rect_for_dead_spider()
self.dead_spiders.append(self.spiders.pop(i))
continue
for i in reversed(xrange(len(self.dead_spiders))):
# collision with bottom screen
if self.dead_spiders[i].rect_dead.top > SCREEN_HEIGHT:
del self.dead_spiders[i]
continue
def check_collision_weapons(self):
for i in reversed(xrange(len(self.weapons))):
# collision with spiders
index_spider = self.weapons[i].rect.collidelist(self.spiders)
if index_spider != -1:
(x, y) = self.spiders[index_spider].rect.centerx, self.spiders[index_spider].rect.centery
self.effects.append(Effects(x, y))
self.spiders[index_spider].hit(self.weapons[i].hit)
if not self.spiders[index_spider].alive():
self.hud.update_score(self.spiders[index_spider].score)
# added bonus
if not self.double_bonus and not self.tripple_bonus:
if random.randint(self.spiders[index_spider].score, 100) >= 90:
if random.random() >= 0.8:
self.double_bonus = False
self.tripple_bonus = True
else:
self.double_bonus = True
self.tripple_bonus = False
self.bonus_time = time.time()
self.dead_spiders.append(self.spiders.pop(index_spider))
del self.weapons[i]
continue
# collison with bottom screen
if self.weapons[i].rect.bottom > SCREEN_HEIGHT:
del self.weapons[i]
continue
self.weapons[i].update()
self.weapons[i].draw(self.surface)
def draw_effects(self):
for i in reversed(xrange(len(self.effects))):
if self.effects[i].alive():
self.effects[i].update()
self.effects[i].draw(self.surface)
else:
del self.effects[i]
def draw_spiders(self):
for spider in self.spiders: