Exemplo n.º 1
0
    def __init__(self, width=1000, height=600):
        super().__init__()

        color = (255, 255, 255)
        gate_width = 100
        gate_height = 300

        self.width = width
        self.width = height

        self.points = [[-width / 2, gate_height / 2, -width / 2, height / 2],
                       [-width / 2, height / 2, width / 2, height / 2],
                       [width / 2, height / 2, width / 2, gate_height / 2],
                       [-width / 2, -gate_height / 2, -width / 2, -height / 2],
                       [-width / 2, -height / 2, width / 2, -height / 2],
                       [width / 2, -height / 2, width / 2, -gate_height / 2]]

        for [s_x, s_y, e_x, e_y] in self.points:
            self.append(
                arcade.create_line(s_x,
                                   s_y,
                                   e_x,
                                   e_y,
                                   color=color,
                                   line_width=5))

        points = [(-width / 2 - gate_width, -gate_height / 2),
                  (-width / 2 - gate_width, +gate_height / 2),
                  (-width / 2, +gate_height / 2),
                  (-width / 2, -gate_height / 2)]
        self.gate_b = arcade.create_rectangle_filled_with_colors(
            point_list=points, color_list=[(40, 40, 200)] * len(points))

        self.gate_b.center_x = SCREEN_WIDTH / 2 - width / 2 - gate_width / 2
        self.gate_b.center_y = SCREEN_HEIGHT / 2

        points = [(width / 2 + gate_width, -gate_height / 2),
                  (width / 2 + gate_width, +gate_height / 2),
                  (width / 2, +gate_height / 2), (width / 2, -gate_height / 2)]
        self.gate_r = arcade.create_rectangle_filled_with_colors(
            point_list=points, color_list=[(200, 40, 40)] * len(points))

        self.gate_r.center_x = SCREEN_WIDTH / 2 + width / 2 + gate_width / 2
        self.gate_r.center_y = SCREEN_HEIGHT / 2

        self.center_x = SCREEN_WIDTH / 2
        self.center_y = SCREEN_HEIGHT / 2

        self.append(self.gate_b)
        self.append(self.gate_r)
        self.append(
            arcade.create_line(s_x, s_y, e_x, e_y, color=color, line_width=5))
        self.append(
            arcade.create_line(s_x, s_y, e_x, e_y, color=color, line_width=5))
Exemplo n.º 2
0
    def __init__(self, width, height, title):
        """
        Set up the application.
        """

        super().__init__(width, height, title)

        arcade.set_background_color(arcade.color.BLACK)

        self.shapes = arcade.ShapeElementList()

        # This is a large rectangle that fills the whole
        # background. The gradient goes between the two colors
        # top to bottom.
        color1 = (215, 214, 165)
        color2 = (219, 166, 123)
        points = (0, 0), (SCREEN_WIDTH, 0), (SCREEN_WIDTH, SCREEN_HEIGHT), (0, SCREEN_HEIGHT)
        colors = (color1, color1, color2, color2)
        rect = arcade.create_rectangle_filled_with_colors(points, colors)
        self.shapes.append(rect)

        # Another rectangle, but in this case the color doesn't change. Just the
        # transparency. This time it goes from left to right.
        color1 = (165, 92, 85, 255)
        color2 = (165, 92, 85, 0)
        points = (100, 100), (SCREEN_WIDTH - 100, 100), (SCREEN_WIDTH - 100, 300), (100, 300)
        colors = (color2, color1, color1, color2)
        rect = arcade.create_rectangle_filled_with_colors(points, colors)
        self.shapes.append(rect)

        # Two lines
        color1 = (7, 67, 88)
        color2 = (69, 137, 133)
        points = (100, 400), (SCREEN_WIDTH - 100, 400), (SCREEN_WIDTH - 100, 500), (100, 500)
        colors = [color2, color1, color2, color1]
        shape = arcade.create_lines_with_colors(points, colors, line_width=5)
        self.shapes.append(shape)

        # Triangle
        color1 = (215, 214, 165)
        color2 = (219, 166, 123)
        color3 = (165, 92, 85)
        points = (SCREEN_WIDTH // 2, 500), (SCREEN_WIDTH // 2 - 100, 400), (SCREEN_WIDTH // 2 + 100, 400)
        colors = (color1, color2, color3)
        shape = arcade.create_triangles_filled_with_colors(points, colors)
        self.shapes.append(shape)

        # Ellipse, gradient between center and outside
        color1 = (69, 137, 133, 127)
        color2 = (7, 67, 88, 127)
        shape = arcade.create_ellipse_filled_with_colors(SCREEN_WIDTH // 2, 350, 50, 50,
                                                         inside_color=color1, outside_color=color2)
        self.shapes.append(shape)
Exemplo n.º 3
0
    def setup(self):
        """
        This, and any function with the arcade.decorator.init decorator,
        is run automatically on start-up.
        """
        self.mountains = []

        background = arcade.ShapeElementList()

        color1 = (195, 157, 224)
        color2 = (240, 203, 163)
        points = (0, 0), (SCREEN_WIDTH, 0), (SCREEN_WIDTH,
                                             SCREEN_HEIGHT), (0, SCREEN_HEIGHT)
        colors = (color1, color1, color2, color2)
        rect = arcade.create_rectangle_filled_with_colors(points, colors)

        background.append(rect)
        self.mountains.append(background)

        layer_4 = create_mountain_range([0, 350], [SCREEN_WIDTH, 320], 1.1,
                                        250, 8, (158, 98, 204))
        self.mountains.append(layer_4)

        layer_3 = create_mountain_range([0, 270], [SCREEN_WIDTH, 190], 1.1,
                                        120, 9, (130, 79, 138))
        self.mountains.append(layer_3)

        layer_2 = create_mountain_range([0, 180], [SCREEN_WIDTH, 80], 1.2, 30,
                                        12, (68, 28, 99))
        self.mountains.append(layer_2)

        layer_1 = create_mountain_range([250, 0], [SCREEN_WIDTH, 200], 1.4, 20,
                                        12, (49, 7, 82))
        self.mountains.append(layer_1)
Exemplo n.º 4
0
 def generate_gradient_background(self):
     color1 = (26, 15, 35)
     color2 = (75, 39, 83)
     points = (0, 0), (SCREEN_WIDTH, 0), (SCREEN_WIDTH,
                                          SCREEN_HEIGHT), (0, SCREEN_HEIGHT)
     colors = (color1, color1, color2, color2)
     rect = arcade.create_rectangle_filled_with_colors(points, colors)
     self.shapes.append(rect)
    def __init__(self, width, height, title):
        """
        Set up the application.
        """
        super().__init__(width, height, title)

        self.shape_list = arcade.ShapeElementList()
        self.shape_list.center_x = SCREEN_WIDTH // 2
        self.shape_list.center_y = SCREEN_HEIGHT // 2
        self.shape_list.angle = 0
        point_list = ((0, 50), (10, 10), (50, 0), (10, -10), (0, -50),
                      (-10, -10), (-50, 0), (-10, 10), (0, 50))
        colors = [
            getattr(arcade.color, color) for color in dir(arcade.color)
            if not color.startswith("__")
        ]
        for i in range(5):
            x = SCREEN_WIDTH // 2 - random.randrange(SCREEN_WIDTH - 50)
            y = SCREEN_HEIGHT // 2 - random.randrange(SCREEN_HEIGHT - 50)
            color = random.choice(colors)
            points = [(px + x, py + y) for px, py in point_list]

            my_line_strip = arcade.create_line_strip(points, color, 5)
            self.shape_list.append(my_line_strip)

        point_list = ((-50, -50), (0, 40), (50, -50))
        for i in range(5):
            x = SCREEN_WIDTH // 2 - random.randrange(SCREEN_WIDTH - 50)
            y = SCREEN_HEIGHT // 2 - random.randrange(SCREEN_HEIGHT - 50)
            points = [(px + x, py + y) for px, py in point_list]
            triangle_filled = arcade.create_triangles_filled_with_colors(
                points, random.sample(colors, 3))
            self.shape_list.append(triangle_filled)

        point_list = ((-50, -70), (-50, 70), (50, 70), (50, -70))
        for i in range(5):
            x = SCREEN_WIDTH // 2 - random.randrange(SCREEN_WIDTH - 50)
            y = SCREEN_HEIGHT // 2 - random.randrange(SCREEN_HEIGHT - 50)
            points = [(px + x, py + y) for px, py in point_list]
            rect_filled = arcade.create_rectangle_filled_with_colors(
                points, random.sample(colors, 4))
            self.shape_list.append(rect_filled)

        point_list = ((100, 100), (50, 150), (100, 200), (200, 200),
                      (250, 150), (200, 100))
        poly = arcade.create_polygon(point_list, (255, 10, 10))
        self.shape_list.append(poly)

        ellipse = arcade.create_ellipse(20, 30, 50, 20, (230, 230, 0))
        self.shape_list.append(ellipse)

        arcade.set_background_color(arcade.color.BLACK)

        self.offscreen = self.ctx.framebuffer(
            color_attachments=self.ctx.texture((SCREEN_WIDTH, SCREEN_HEIGHT),
                                               wrap_x=gl.GL_CLAMP_TO_EDGE,
                                               wrap_y=gl.GL_CLAMP_TO_EDGE))
        self.glow = postprocessing.BloomEffect((SCREEN_WIDTH, SCREEN_HEIGHT))
Exemplo n.º 6
0
    def __init__(self, width, height):
        """
        Set up the application.
        """
        super().__init__(width, height)

        self.shape_list = arcade.ShapeElementList()
        self.shape_list.center_x = SCREEN_WIDTH // 2
        self.shape_list.center_y = SCREEN_HEIGHT // 2
        self.shape_list.angle = 0
        point_list = ((0, 50), (10, 10), (50, 0), (10, -10), (0, -50),
                      (-10, -10), (-50, 0), (-10, 10), (0, 50))
        colors = [
            getattr(arcade.color, color) for color in dir(arcade.color)
            if not color.startswith("__")
        ]
        for i in range(5):
            x = SCREEN_WIDTH // 2 - random.randrange(SCREEN_WIDTH - 50)
            y = SCREEN_HEIGHT // 2 - random.randrange(SCREEN_HEIGHT - 50)
            color = random.choice(colors)
            points = [(px + x, py + y) for px, py in point_list]

            my_line_strip = arcade.create_line_strip(points, color, 5)
            self.shape_list.append(my_line_strip)

        point_list = ((-50, -50), (0, 40), (50, -50))
        for i in range(5):
            x = SCREEN_WIDTH // 2 - random.randrange(SCREEN_WIDTH - 50)
            y = SCREEN_HEIGHT // 2 - random.randrange(SCREEN_HEIGHT - 50)
            points = [(px + x, py + y) for px, py in point_list]
            triangle_filled = arcade.create_triangles_filled_with_colors(
                points, random.sample(colors, 3))
            self.shape_list.append(triangle_filled)

        point_list = ((-50, -70), (-50, 70), (50, 70), (50, -70))
        for i in range(5):
            x = SCREEN_WIDTH // 2 - random.randrange(SCREEN_WIDTH - 50)
            y = SCREEN_HEIGHT // 2 - random.randrange(SCREEN_HEIGHT - 50)
            points = [(px + x, py + y) for px, py in point_list]
            rect_filled = arcade.create_rectangle_filled_with_colors(
                points, random.sample(colors, 4))
            self.shape_list.append(rect_filled)

        point_list = ((100, 100), (50, 150), (100, 200), (200, 200),
                      (250, 150), (200, 100))
        poly = arcade.create_polygon(point_list, (255, 10, 10), 5)
        self.shape_list.append(poly)

        ellipse = arcade.create_ellipse(20, 30, 50, 20, (230, 230, 0))
        self.shape_list.append(ellipse)

        arcade.set_background_color(arcade.color.BLACK)
Exemplo n.º 7
0
    def __init__(self, width, height, title):
        super().__init__(width, height, title)

        self.shapes = arcade.ShapeElementList()

        color1 = (10, 90, 120)
        color2 = (0, 20, 32)
        points = (0, 0), (SCREEN_WIDTH, 0), (SCREEN_WIDTH, SCREEN_HEIGHT), (0, SCREEN_HEIGHT)
        colors = (color1, color1, color2, color2)
        rect = arcade.create_rectangle_filled_with_colors(points, colors)
        self.shapes.append(rect)

        self.raindrop_list = None
def create_mountain_range(start, end, roughness, vertical_displacement,
                          num_of_iterations, color_start):

    shape_list = arcade.ShapeElementList()

    layer_1 = midpoint_displacement(start, end, roughness,
                                    vertical_displacement, num_of_iterations)
    layer_1 = fix_points(layer_1)

    color_list = [color_start] * len(layer_1)
    lines = arcade.create_rectangle_filled_with_colors(layer_1, color_list)
    shape_list.append(lines)

    return shape_list
Exemplo n.º 9
0
    def __init__(self, width, height):
        super().__init__()

        self.width = width
        self.height = height

        # Create the background color and append to the shape list.
        bg_points = [(0, height), (width, height), (width, 0), (0, 0)]
        bg_color_top = arcade.color.BLACK
        bg_color_bottom = arcade.color.MIDNIGHT_BLUE
        bg_colors = [
            bg_color_top, bg_color_top, bg_color_bottom, bg_color_bottom
        ]
        bg_rect = arcade.create_rectangle_filled_with_colors(
            bg_points, bg_colors)
        self.append(bg_rect)

        # Generate a large number of small stars and a few big ones.
        self.generate_stars(SMALL_STARS_MIN, SMALL_STARS_MAX,
                            SMALL_STAR_RADIUS_MIN, SMALL_STAR_RADIUS_MAX)
        self.generate_stars(LARGE_STARS_MIN, LARGE_STARS_MAX,
                            LARGE_STAR_RADIUS_MIN, LARGE_STAR_RADIUS_MAX)
Exemplo n.º 10
0
    def on_draw(self):
        arcade.start_render()
        arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
                                            self.background)
        self.title_text.draw()

        arcade.draw_text(self.progress_message,
                         SCREEN_WIDTH // 2,
                         SCREEN_HEIGHT * 0.6,
                         arcade.color.WHITE,
                         font_size=18,
                         anchor_x="center")

        gradient_color1 = (255, 215, 0, 255)
        gradient_color2 = (255, 215, 0, 0)
        gradient_colors = (gradient_color2, gradient_color1, gradient_color1,
                           gradient_color2)

        loading_bar_x_left = SCREEN_WIDTH * 0.1
        loading_bar_y_down = SCREEN_HEIGHT * 0.45
        loading_bar_y_up = SCREEN_HEIGHT * 0.55

        loading_bar_progress_x = SCREEN_WIDTH * 0.8 * (
            self.progress / GAME_LOAD_COUNT) + SCREEN_WIDTH * 0.1

        points = ((loading_bar_x_left, loading_bar_y_down),
                  (loading_bar_progress_x, loading_bar_y_down),
                  (loading_bar_progress_x,
                   loading_bar_y_up), (loading_bar_x_left, loading_bar_y_up))

        loading_bar = arcade.create_rectangle_filled_with_colors(
            points, gradient_colors)
        loading_bar.draw()

        self.star.center_x = loading_bar_progress_x
        self.star.draw()
Exemplo n.º 11
0
    def __init__(self):
        """
        Set up the application.
        """

        super().__init__()

        self.shapes = arcade.ShapeElementList()

        # This is a large rectangle that fills the whole
        # background. The gradient goes between the two colors
        # top to bottom.
        color1 = (6, 90, 182)
        color2 = (72, 177, 191)
        points = (0, 0), (SCREEN_WIDTH, 0), (SCREEN_WIDTH, SCREEN_HEIGHT), (0, SCREEN_HEIGHT)
        colors = (color1, color1, color2, color2)
        rect = arcade.create_rectangle_filled_with_colors(points, colors)
        self.shapes.append(rect)
        self.alexander_image = arcade.Sprite(":resources:images/hamilton.png", 0.3)
        self.alexander_image.center_x = 80
        self.alexander_image.center_y = 200
        self.welcome_image = arcade.Sprite(":resources:images/wel.png", 1)
        self.welcome_image.center_x = 200
        self.welcome_image.center_y = 500
Exemplo n.º 12
0
def make_objects():
    shape_list = arcade.ShapeElementList()

    center_x = 0
    center_y = 0
    width = 20
    height = 20
    shape = arcade.create_ellipse_filled(center_x, center_y, width, height,
                                         arcade.color.WHITE)
    shape_list.append(shape)

    center_x += 40
    shape = arcade.create_ellipse_outline(center_x,
                                          center_y,
                                          width,
                                          height,
                                          arcade.color.RED,
                                          border_width=1)
    shape_list.append(shape)

    center_x += 40
    shape = arcade.create_ellipse_outline(center_x,
                                          center_y,
                                          width,
                                          height,
                                          arcade.color.DARK_RED,
                                          border_width=1)
    shape_list.append(shape)

    shape = arcade.create_line(0, 0, 80, 0, arcade.color.BLUE, line_width=1)
    shape_list.append(shape)

    shape = arcade.create_line(0,
                               0,
                               80,
                               0,
                               arcade.color.LIGHT_BLUE,
                               line_width=1)
    shape_list.append(shape)

    center_x = 0
    center_y = 50
    width = 20
    height = 20
    outside_color = arcade.color.AERO_BLUE
    inside_color = arcade.color.AFRICAN_VIOLET
    tilt_angle = 45
    shape = arcade.create_ellipse_filled_with_colors(center_x, center_y, width,
                                                     height, outside_color,
                                                     inside_color, tilt_angle)
    shape_list.append(shape)

    center_x = 0
    center_y = -50
    width = 20
    height = 20
    shape = arcade.create_rectangle_filled(center_x, center_y, width, height,
                                           arcade.color.WHITE)
    shape_list.append(shape)
    shape = arcade.create_rectangle_outline(center_x,
                                            center_y,
                                            width,
                                            height,
                                            arcade.color.BLACK,
                                            border_width=1)
    shape_list.append(shape)
    shape = arcade.create_rectangle_outline(center_x,
                                            center_y,
                                            width,
                                            height,
                                            arcade.color.AMERICAN_ROSE,
                                            border_width=1)
    shape_list.append(shape)

    color1 = (215, 214, 165)
    color2 = (219, 166, 123)
    points = (70, 70), (150, 70), (150, 150), (70, 150)
    colors = (color1, color1, color2, color2)
    shape = arcade.create_rectangle_filled_with_colors(points, colors)
    shape_list.append(shape)

    points = (0, 0), (150, 150), (0, 150), (0, 250)
    shape = arcade.create_line_strip(points, arcade.color.AFRICAN_VIOLET)
    shape_list.append(shape)

    points = (0, 0), (75, 90), (60, 150), (90, 250)
    shape = arcade.create_line_generic(points, arcade.color.ALIZARIN_CRIMSON,
                                       gl.GL_TRIANGLE_FAN)
    shape_list.append(shape)

    return shape_list
Exemplo n.º 13
0
    def setup(self):
        super().setup()

        # Load song and get waveform
        with LogSection(logger, "loading song and waveform"):
            with pkg_resources.path(charm.data.audio, "fourth_wall.wav") as p:
                self._song = arcade.load_sound(p)
                load = librosa.load(p, mono=True)
            self.waveform: ndarray[float] = load[0]
            self.sample_rate: int = load[1]

        # Create an index of samples
        with LogSection(logger, "indexing samples"):
            samples: list[SoundPoint] = []
            for n, s in enumerate(self.waveform):
                samples.append(SoundPoint((1 / self.sample_rate) * n, s))
            self.samples = nindex.Index(samples, "time")

        # Create an index of beats
        with LogSection(logger, "indexing beats"):
            self.bpm, beats = librosa.beat.beat_track(y = self.waveform, sr = self.sample_rate, units = "time")
            self.beats = nindex.Index([Beat(t) for t in beats[::2]], "time")

        self.chart_available = False
        # Create an index of chart notes
        with LogSection(logger, "parsing chart"):
            path = songspath / "fnf" / "fourth-wall"
            self.songdata = FNFSong.parse(path)
        if self.songdata:
            with LogSection(logger, "indexing notes"):
                self.chart_available = True
                self.player_chart = nindex.Index(self.songdata.charts[0].notes, "time")
                enemy_chart = self.songdata.get_chart(2, self.songdata.charts[0].difficulty)
                self.enemy_chart = nindex.Index(enemy_chart.notes, "time")
            with LogSection(logger, "generating highway"):
                self.highway = FNFHighway(self.songdata.charts[0], (((Settings.width // 3) * 2), 0), auto = True)

        # Create background stars
        with LogSection(logger, "creating stars"):
            self.star_camera = arcade.Camera()
            self.stars = arcade.SpriteList()
            self.scroll_speed = 20  # px/s
            stars_per_screen = 100
            star_height = Settings.height + int(self._song.source.duration * self.scroll_speed)
            star_amount = int(stars_per_screen * (star_height / Settings.height))
            logger.info(f"Generating {star_amount} stars...")
            for i in range(star_amount):
                sprite = arcade.SpriteCircle(5, arcade.color.WHITE + (255,), True)
                sprite.center_x = randint(0, Settings.width)
                sprite.center_y = randint(-(star_height - Settings.height), Settings.height)
                self.stars.append(sprite)

        with LogSection(logger, "creating text"):
            self.text = arcade.Text("Fourth Wall by Jacaris", Settings.width / 4, Settings.height * (0.9),
            font_name = "Determination Sans", font_size = 32, align="center", anchor_x="center", anchor_y="center", width = Settings.width)

        with LogSection(logger, "making gradient"):
            # Gradient
            self.gradient = arcade.create_rectangle_filled_with_colors(
                [(-250, Settings.height), (Settings.width + 250, Settings.height), (Settings.width + 250, -250), (-250, -250)],
                [arcade.color.BLACK, arcade.color.BLACK, arcade.color.DARK_PASTEL_PURPLE, arcade.color.DARK_PASTEL_PURPLE]
            )

        with LogSection(logger, "loading sprites"):
            self.scott_atlas = arcade.TextureAtlas((8192, 8192))
            self.sprite_list = arcade.SpriteList(atlas = self.scott_atlas)
            self.sprite = sprite_from_adobe("scott", ("bottom", "left"))
            self.boyfriend = sprite_from_adobe("bfScott", ("bottom", "right"))
            self.sprite_list.append(self.sprite)
            self.sprite_list.append(self.boyfriend)
            self.sprite.cache_textures()
            self.boyfriend.cache_textures()
            self.sprite.bottom = 0
            self.sprite.left = 0
            self.boyfriend.bottom = 0
            self.boyfriend.right = Settings.width - 50
            self.sprite.set_animation("idle")
            self.boyfriend.set_animation("idle")

        # Settings
        with LogSection(logger, "finalizing setup"):
            self.multiplier = 250
            self.y = Settings.height // 2
            self.line_width = 1
            self.x_scale = 2
            self.resolution = 4
            self.beat_time = 0.5
            self.show_text = False

            # RAM
            self.pixels: list[tuple[int, int]] = [(0, 0) * Settings.width]
            self.last_beat = -self.beat_time
            self.last_enemy_note: FNFNote = None
            self.last_player_note: FNFNote = None
            self.did_harcode = False
Exemplo n.º 14
0
    def on_update(self, delta_time):
        # clear the shape list for the new frame
        self.shape_list = arcade.ShapeElementList()
        # self.minimap_shape_list = arcade.ShapeElementList()

        # set the floor and ceiling colors
        floor = arcade.create_rectangle(
            self.screen_width // 2, int(self.screen_height * 0.25),
            self.screen_width, self.screen_height // 2,
            self.floor_color
        )

        ceiling = arcade.create_rectangle(
            self.screen_width // 2, int(self.screen_height * 0.75),
            self.screen_width, self.screen_height // 2,
            self.ceiling_color
        )

        # add the floor and ceiling shapes to the shape_list
        self.shape_list.append(floor)
        self.shape_list.append(ceiling)

        # create the point_list and color_list for raycasting
        point_list = []
        color_list = []

        # begin raycasting
        for x in range(0, self.screen_width + 1):
            # calculate the ray position and direction
            camera_x = (2 * x / self.screen_width) - 1
            if camera_x > 1 or camera_x < -1:
                print('camera_x is too big or too small!')
                print(f'camera_x = {camera_x}')
            ray_dir_x = self.dir_x + self.plane_x * camera_x
            ray_dir_y = self.dir_y + self.plane_y * camera_x

            # determine which grid-square of the map we're in
            map_x = int(self.pos_x)
            map_y = int(self.pos_y)

            # length of ray from the current position to the next vertical gridline
            side_dist_x = None
            # length of ray from the current position to the next horizontal gridline
            side_dist_y = None

            # length of the ray from one horizontal or vertical gridline to the next one
            try:
                delta_dist_x = abs(1 / ray_dir_x)
            except ZeroDivisionError:
                if ray_dir_y == 0:
                    delta_dist_x = 0
                elif ray_dir_x == 0:
                    delta_dist_x = 1
                else:
                    delta_dist_x = abs(1 / ray_dir_x)

            try:
                delta_dist_y = abs(1 / ray_dir_y)
            except ZeroDivisionError:
                if ray_dir_x == 0:
                    delta_dist_y = 0
                elif ray_dir_y == 0:
                    delta_dist_y = 1
                else:
                    delta_dist_y = abs(1 / ray_dir_y)

            # the distance to the next perpendicular wall
            perpendicular_wall_dist = None

            # which direction to step in the x direction or the y direction (either +1 or -1)
            step_x = None
            step_y = None

            # was a there a wall hit?
            hit = 0

            # was a North/South wall hit or an East/West wall hit?
            side = None

            if ray_dir_x < 0:
                step_x = -1
                side_dist_x = (self.pos_x - map_x) * delta_dist_x
            else:
                step_x = 1
                side_dist_x = (map_x + 1 - self.pos_x) * delta_dist_x

            if ray_dir_y < 0:
                step_y = -1
                side_dist_y = (self.pos_y - map_y) * delta_dist_y
            else:
                step_y = 1
                side_dist_y = (map_y + 1 - self.pos_y) * delta_dist_y

            new_map_x = False
            new_map_y = False

            # continually cast the ray out into the distance until it hits a wall
            while hit == 0:
                if side_dist_x < side_dist_y:
                    side_dist_x += delta_dist_x
                    map_x += step_x
                    side = 0
                else:
                    side_dist_y += delta_dist_y
                    map_y += step_y
                    side = 1

                # check if the ray has hit a wall yet
                if 0 < self.map[map_x][map_y] < 10:
                    hit = 1
                    if map_x != self.last_map_x:
                        new_map_x = True
                        self.last_map_x = map_x
                    if map_y != self.last_map_y:
                        new_map_y = True
                        self.last_map_y = map_y
                    if not self.minimap[map_x][map_y]:
                        self.minimap[map_x][map_y] = True
                        # top-left
                        self.mm_point_list.append(
                            (MINIMAP_POS_X + map_x * MINIMAP_SIZE, MINIMAP_POS_Y + map_y * MINIMAP_SIZE + MINIMAP_SIZE))
                        self.mm_color_list.append(arcade.color.BLACK)
                        # top-right
                        self.mm_point_list.append((MINIMAP_POS_X + map_x * MINIMAP_SIZE + MINIMAP_SIZE,
                                                   MINIMAP_POS_Y + map_y * MINIMAP_SIZE + MINIMAP_SIZE))
                        self.mm_color_list.append(arcade.color.BLACK)
                        # bottom-right
                        self.mm_point_list.append(
                            (MINIMAP_POS_X + map_x * MINIMAP_SIZE + MINIMAP_SIZE, MINIMAP_POS_Y + map_y * MINIMAP_SIZE))
                        self.mm_color_list.append(arcade.color.BLACK)
                        # bottom-left
                        self.mm_point_list.append(
                            (MINIMAP_POS_X + map_x * MINIMAP_SIZE, MINIMAP_POS_Y + map_y * MINIMAP_SIZE))
                        self.mm_color_list.append(arcade.color.BLACK)
                elif 10 <= self.map[map_x][map_y] < 20:
                    hit = 2

            if side == 0:
                perpendicular_wall_dist = (map_x - self.pos_x + (1 - step_x) / 2) / (ray_dir_x + 0.00000001)
            else:
                perpendicular_wall_dist = (map_y - self.pos_y + (1 - step_y) / 2) / (ray_dir_y + 0.00000001)

            """
            **********************************************
            MODIFY CODE BELOW FOR ALLOWING PITS/HIGH WALLS
            **********************************************
            """

            # the height of the wall at the given pixel column
            line_height = int(self.screen_height / (perpendicular_wall_dist + 0.00000001))

            # the pixel (height) at which to start drawing the wall
            draw_start = -line_height / 2 + self.screen_height / 2

            if draw_start < 0:
                draw_start = 0

            if hit == 1:  # if the wall is single-height
                draw_end = line_height / 2 + self.screen_height / 2
            elif hit == 2:  # otherwise, if the wall is double-height
                draw_end = line_height + self.screen_height / 2
            if draw_end >= self.screen_height:
                draw_end = self.screen_height - 1

            # set the color with which to draw the given pixel column
            if side == 0:
                try:
                    color = self.main_wall_color_list[self.map[map_x][map_y] % 10]
                except IndexError:
                    color = arcade.color.YELLOW
            elif side == 1:
                try:
                    color = self.dark_wall_color_list[self.map[map_x][map_y] % 10]
                except IndexError:
                    color = arcade.color.DARK_YELLOW

            draw_start_pos = (x, draw_start)
            draw_end_pos = (x, draw_end)
            point_list.append(draw_start_pos)
            point_list.append(draw_end_pos)
            if new_map_x or new_map_y:
                color = arcade.color.BLACK
            for i in range(2):
                color_list.append(color)

        shape = arcade.create_line_generic_with_colors(point_list, color_list, 3)
        self.shape_list.append(shape)

        minimap_background = arcade.create_rectangle_filled_with_colors(self.mm_bg_points, self.mm_bg_colors)
        self.shape_list.append(minimap_background)

        minimap_shape = arcade.create_rectangles_filled_with_colors(self.mm_point_list, self.mm_color_list)
        self.shape_list.append(minimap_shape)

        ppos_point_list = []
        ppos_color_list = []

        # top-left
        ppos_point_list.append(
            (MINIMAP_POS_X + self.pos_x * MINIMAP_SIZE, MINIMAP_POS_Y + self.pos_y * MINIMAP_SIZE + MINIMAP_SIZE))
        ppos_color_list.append(arcade.color.BLUE)
        # top-right
        ppos_point_list.append((MINIMAP_POS_X + self.pos_x * MINIMAP_SIZE + MINIMAP_SIZE,
                                MINIMAP_POS_Y + self.pos_y * MINIMAP_SIZE + MINIMAP_SIZE))
        ppos_color_list.append(arcade.color.RED)
        # bottom-right
        ppos_point_list.append(
            (MINIMAP_POS_X + self.pos_x * MINIMAP_SIZE + MINIMAP_SIZE, MINIMAP_POS_Y + self.pos_y * MINIMAP_SIZE))
        ppos_color_list.append(arcade.color.BLUE)
        # bottom-left
        ppos_point_list.append((MINIMAP_POS_X + self.pos_x * MINIMAP_SIZE, MINIMAP_POS_Y + self.pos_y * MINIMAP_SIZE))
        ppos_color_list.append(arcade.color.BLUE)

        player_shape = arcade.create_rectangle_filled_with_colors(ppos_point_list, ppos_color_list)
        self.shape_list.append(player_shape)

        self.old_time = self.time
        self.time += delta_time

        # frame_time is the amount of time this frame spent on screen (in seconds)
        self.frame_time = (self.time - self.old_time)

        FPS = 1 / self.frame_time
        """
        ********************************************************
        HERE IS WHERE THE CODE FOR AUTO QUALITY ADJUST SHOULD GO
        ********************************************************
        """
        if FPS < 60 and self.render_resolution > 2:
            self.render_resolution -= 1
        if FPS > 60:
            self.render_resolution += 1

        self.move_speed = self.frame_time * self.constant_move_speed
        self.rotation_speed = self.frame_time * self.constant_rotation_speed
        # print(f'constant rotation speed: {self.constant_rotation_speed}\nframe time: {frame_time}\nadjusted rotation speed: {self.rotation_speed}')
        self.rotation_speed *= (self.rotate_x_magnitude / 100)

        if self.move_forward:
            if not self.map[int(self.pos_x + self.dir_x * self.move_speed)][int(self.pos_y)]:
                self.pos_x += self.dir_x * self.move_speed
            if not self.map[int(self.pos_x)][int(self.pos_y + self.dir_y * self.move_speed)]:
                self.pos_y += self.dir_y * self.move_speed
        elif self.move_backward:
            if not self.map[int(self.pos_x - self.dir_x * self.move_speed)][int(self.pos_y)]:
                self.pos_x -= self.dir_x * self.move_speed
            if not self.map[int(self.pos_x)][int(self.pos_y - self.dir_y * self.move_speed)]:
                self.pos_y -= self.dir_y * self.move_speed

        if self.strafe_left:
            if not self.map[int(self.pos_x - self.dir_y * self.move_speed)][int(self.pos_y)]:
                self.pos_x -= self.dir_y * self.move_speed
            if not self.map[int(self.pos_x)][int(self.pos_y + self.dir_x * self.move_speed)]:
                self.pos_y += self.dir_x * self.move_speed
        elif self.strafe_right:
            if not self.map[int(self.pos_x + self.dir_y * self.move_speed)][int(self.pos_y)]:
                self.pos_x += self.dir_y * self.move_speed
            if not self.map[int(self.pos_x)][int(self.pos_y - self.dir_x * self.move_speed)]:
                self.pos_y -= self.dir_x * self.move_speed

        if self.rotate_left:
            # both camera direction and camera plane must be rotated
            old_dir_x = self.dir_x
            self.dir_x = self.dir_x * math.cos(self.rotation_speed) - self.dir_y * math.sin(self.rotation_speed)
            self.dir_y = old_dir_x * math.sin(self.rotation_speed) + self.dir_y * math.cos(self.rotation_speed)
            old_plane_x = self.plane_x
            self.plane_x = self.plane_x * math.cos(self.rotation_speed) - self.plane_y * math.sin(self.rotation_speed)
            self.plane_y = old_plane_x * math.sin(self.rotation_speed) + self.plane_y * math.cos(self.rotation_speed)
        elif self.rotate_right:
            # both camera direction and camera plane must be rotated
            old_dir_x = self.dir_x
            self.dir_x = self.dir_x * math.cos(-self.rotation_speed) - self.dir_y * math.sin(-self.rotation_speed)
            self.dir_y = old_dir_x * math.sin(-self.rotation_speed) + self.dir_y * math.cos(-self.rotation_speed)
            old_plane_x = self.plane_x
            self.plane_x = self.plane_x * math.cos(-self.rotation_speed) - self.plane_y * math.sin(-self.rotation_speed)
            self.plane_y = old_plane_x * math.sin(-self.rotation_speed) + self.plane_y * math.cos(-self.rotation_speed)
        if self.mouse_look:
            self.mouse_look = False
            self.rotate_right = False
            self.rotate_left = False