def show_disembarking(self, person: sprites.PersonSprite, elevator: sprites.ElevatorSprite) -> None: """Show disembarking of the given person from the given elevator.""" if not self._visualize: return from_x = person.rect.centerx target_x = 10 elevator.update() for frame in range(21): # Move in 20 seconds x = from_x + (target_x - from_x) * frame // 20 person.rect.centerx = x self.render()
def show_disembarking(self, person: sprites.PersonSprite, elevator: sprites.ElevatorSprite) -> None: """Show disembarking of the given person from the given elevator.""" if not self._visualize: return from_x = person.rect.centerx target_x = WIDTH - 10 # print("dismbarking") # print("IN VISUALIZER FULLNESS:", elevator.fullness()) elevator.update() for frame in range(21): # Move in 20 seconds x = from_x + (target_x - from_x) * frame // 20 person.rect.centerx = x self.render()
def show_boarding(self, person: sprites.PersonSprite, elevator: sprites.ElevatorSprite) -> None: """Show boarding of the given person onto the given elevator. Precondition: the given person is on the same floor as the elevator. """ if not self._visualize: return from_x = 10 target_x = elevator.rect.centerx + random.randint(-3, 3) for frame in range(21): # Move in 20 seconds person.rect.centerx = from_x + (target_x - from_x) * frame // 20 self.render() elevator.update() self.render()