本文整理汇总了Python中Timer.is_started方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.is_started方法的具体用法?Python Timer.is_started怎么用?Python Timer.is_started使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer.is_started方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainGame
# 需要导入模块: import Timer [as 别名]
# 或者: from Timer import is_started [as 别名]
#.........这里部分代码省略.........
for i in self.winning_frogs:
if i.rect.colliderect(r):
unoccupied = False
# Place the fly in a goal that is not
# taken up by a frog
while not unoccupied:
unoccupied = True
r = self.goalRects[random.randrange(len(self.goalRects))]
for i in self.winning_frogs:
if i.rect.colliderect(r):
unoccupied = False
# Place the fly and tell draw() to draw it
self.fly.rect.left = r.left + 2
self.fly.rect.top = r.top + 2
self.fly_shown = True
# Hide the fly 6 seconds after being shown
elif self.fly_timer.get_seconds() == 0 and self.fly_shown:
self.fly_shown = False
self.fly_appear_timer.reset()
# Checks if the game is over,
# Changes the timer,
# Toggles the fly
# Handles other logic
def play(self):
if not self.fly_appear_timer.is_started():
self.fly_appear_timer.start()
# End the game if the player is out of lives
if self.lives == 0:
self.message = "Game over. You need more practice."
self.messageSurface = self.font.render(self.message, True, (255, 255, 255))
self.game_over = True
if self.game_over_time == 0:
self.game_over_time = pygame.time.get_ticks()
self.timer.toggle_pause()
# End the game if the level limit has been reached
if self.level >= MAX_LEVELS:
self.game_over = True
self.message = "For more levels, send $10 to [email protected]"
self.messageSurface = self.font.render(self.message, True, (255, 255, 255))
if self.game_over_time == 0:
self.game_over_time = pygame.time.get_ticks()
self.timeSinceNew = self.timer.get_seconds()
# Check if the timer ran out
if self.timeSinceNew == 0:
# frog will die, new one spawn
self.killFrog()
self.timer.reset()
pass
if len(self.frogs) > 0:
# Play the frog's animation if it's jumping