def slide(time): global HELP_SLIDE # Help params help_height = 670 help_speed = 40 # Slide ended slide_end = False # Slide up if scene.get() is 'help': if HELP_SLIDE <= -1 * help_speed: HELP_SLIDE = HELP_SLIDE + help_speed else: slide_end = True # Slide down else: if HELP_SLIDE >= -1 * help_height: HELP_SLIDE = HELP_SLIDE - help_speed else: slide_end = True # Schedule needed? if slide_end is False: pyglet.clock.schedule_once(slide, 0.01) return True
def animer(dt): # Can animate? if scene.get() is not 'game': return False # Game won if state() is 'win' or state() is 'loose': cursor.set('default') background.scene_speed('pause') return False # Game not paused if not paused() and state() is not 'win' and state() is not 'loose': if mode.get() is 'bacteria': cell.creerCellule(corps) creerPhagocyte(corps) mitosis.mitose(corps) projectile.creerProjectile(corps) dynamics.deplacerCorps(corps) set_state(corps) elif mode.get() is "virus": cell.creerCellule(corps) creerPhagocyte(corps) virus.creerVirus(corps) dynamics.deplacerCorps(corps) set_state(corps) # Schedule the next update pyglet.clock.schedule_once(animer, 0.01) return True