Beispiel #1
0
    def __prepare_lanes(self):
        max_number_of_lane = int(self.height /
                                 (lane.MINIMUM_WIDTH + LANE_SPACE * 2)) - 1
        # print(max_number_of_lane)
        if max_number_of_lane <= 0:
            raise Exception("Your screen size is way too small")

        for i in range(1, max_number_of_lane + 1):
            origin = (float(-self.width / 2), -self.height / 2 +
                      (lane.MINIMUM_WIDTH + LANE_SPACE * 2) * i)
            new_lane = Lane(origin,
                            width=self.width,
                            height=lane.MINIMUM_WIDTH + LANE_SPACE * 2,
                            should_draw_outline=False)
            if i % 2 == 0:
                new_lane.direction = Direction.RIGHT_TO_LEFT

            self.lanes.append(new_lane)