def __init__(self): super(Player, self).__init__('player', flip_image=True, obey_gravity=True) self.engine = get_engine() self.should_check_collisions = True # Sprites self.propulsion_below = Sprite("propulsion_below", flip_image=True) self.propulsion_below.collidable = False self.propulsion_below.visible = 0 self.tractor_beam = TractorBeam(self) # State self.jumping = False self.hovering = False self.block_events = False self.jump_origin = None self.hover_time_ms = 0 self.health = self.MAX_HEALTH self.lives = self.MAX_LIVES self.last_safe_spot = None self.vehicle = None self.vehicle_move_cnx = None # Signals self.health_changed = Signal() self.lives_changed = Signal() self.direction_changed.connect(self.on_direction_changed) self.reverse_gravity_changed.connect(self.on_reverse_gravity_changed)
def start(self): ui_manager = get_engine().ui_manager attrs = { 'font': ui_manager.small_font, } self.widget = ui_manager.show_textbox([ (attrs, line) for line in self.text.split('\n') ]) super(TextPage, self).start()
def __init__(self, ms, cb, one_shot=False): self.engine = get_engine() self.ms = ms self.cb = cb self.tick_count_count = 0 self.started = False self.paused_for_ms = 0 self.unpause_cb = None self.one_shot = one_shot self.tick_cnx = None if ms > 0: self.start()