def reset(self): reset_animations() set_global_pause(False) self.space = None if hasattr(self, 'dynamic_objects'): _objs = self.dynamic_objects for obj in _objs: if hasattr(obj, 'stop_animation'): obj.stop_animation() del obj self.dynamic_objects = [] if hasattr(self, 'static_objects'): _objs = self.static_objects for obj in _objs: if hasattr(obj, 'stop_animation'): obj.stop_animation() del obj self.static_objects = [] self._objs = [] self.characters = [] self.dragged = {} self.ui = None self.menu = None self.loader = None self.scene = None self.hero = None self.holy_carrot = None
def resume(self, btn=None): self.paused = False Clock.schedule_interval(self.update, self.spf) set_global_pause(False) if btn: btn.set_resumed() btn.unbind(on_release=self.resume) btn.bind(on_release=self.pause) color, rect = self.folding_screen color.rgba = 0, 0, 0, 0
def pause(self, btn=None): self.paused = True Clock.unschedule(self.update) set_global_pause(True) if btn: btn.set_paused() btn.unbind(on_release=self.pause) btn.bind(on_release=self.resume) if self.folding_screen: color, rect = self.folding_screen color.rgba = 0, 0, 0, .5 return with self.canvas.after: self.folding_screen = [Color(0, 0, 0, .5), Rectangle(pos=self.pos, size=self.size)]