def on_go_mountains(self, dt): # print('GoBackgroundMockDispatcher:on_go_mountains => ', self.road and self.road.state) if self.road is None and self.parent.__class__.__name__ == 'Scene' and len( self.parent.children) > 0: self.road = ValidObject.road( GetObject.get_child(self.parent, 'Road')) if self.bike is None: self.bike = GetObject(road=self.road).bike if self.road.has_finished() or (self.road.state in ( State.ON_RELAX_STOP, State.ON_WAIT_MOVE, State.ON_WAIT_STOP)) or self.bike.get_collisions('Rock'): self.go_mountains_stop() return False else: if self.is_repeat_texture: print('+ GoBackgroundMockDispatcher:on_go_mountains') uvpos_x = self.texture.uvpos[0] + (self.bike.speed * dt) / 100.0 self.texture.uvpos = uvpos_x, self.texture.uvpos[1] repeat_texture(self.texture) redraw_texture(self, 'texture') return True return False
def map_text(self): if not self.road: self.road = ValidObject.road(self.scene.children[1]) res = [ self.format_map_elem(e, not bool(i)) for i, e in enumerate(self.road.level.map) ] return ', '.join([e for e in res])
def _collision(self, bike): bike.speed = 0 bike.power = 0 bike.acceleration = 0 bike.collected_currency = 0 bike.finish_dt = time.time() bike.anim_collision() self.draw_collision_rectangle(bike) # show finish information road = ValidObject.road(GetObject.get_child(bike.parent, 'Road')) curtain = Curtain(road=road, font_size=FS.H1.value) curtain.text = curtain.collision_text_rock() curtain.add_to_game_screen()
def road(self): try: road = self._road if self._road else StatusBar.get_road() return ValidObject.road(road) except AttributeError: return None
def slider_map_max(self): if not self.road and self.parent: screen = ValidObject.screen(self.parent.parent.parent) self.road = ValidObject.road(screen.ids['road']) return self.road.total_way
def get_road(self) -> Optional[Widget]: return self.parent and ValidObject.road( GetObject.get_child(self.parent, 'Road'))
def get_road(self): return self.parent and ValidObject.road( GetObject.get_child(self.parent, 'Road'))