How to use the arcade.color function in arcade

To help you get started, we’ve selected a few arcade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pvcraven / arcade / examples / Testing_shapes.py View on Github external
on_draw.oval = arcade.Oval(250, 250, 50, 25, arcade.color.ORANGE)
on_draw.oval.change_x = 1
on_draw.oval.change_y = -1

on_draw.ellipse = arcade.Ellipse(500, 0, 25, 50, arcade.color.COCONUT)
on_draw.ellipse.change_y = 2
on_draw.ellipse.change_angle = 15

on_draw.circle = arcade.Circle(350, 250, 15, arcade.color.BLUE)
on_draw.circle.change_x = 1

on_draw.square = arcade.Square(350, 150, 20, arcade.color.GREEN, 12, 12)
on_draw.square.change_angle = 20

on_draw.m_circle = arcade.Circle(700, 550, 18, arcade.color.CORNFLOWER_BLUE)
on_draw.m_circle.change_x = -2

on_draw.m_rectangle = arcade.Rectangle(400, 300, 27, 18,
                                       arcade.color.KOMBU_GREEN)
on_draw.m_rectangle.change_x = 3
on_draw.m_rectangle.change_y = -3

on_draw.m_square = arcade.Square(50, 50, 27,
                                 arcade.color.LANGUID_LAVENDER, 6, 45)
on_draw.m_square.change_y = 5

shapes = [on_draw.m_square, on_draw.m_rectangle, on_draw.m_circle]

on_draw.point = arcade.Point(90, 90, 25, arcade.color.FOREST_GREEN)
on_draw.point.change_y = .5
shapes.append(on_draw.point)
github pvcraven / arcade / arcade / examples / sprite_move_keyboard.py View on Github external
# Set the working directory (where we expect to find files) to the same
        # directory this .py file is in. You can leave this out of your own
        # code, but it is needed to easily run the examples using "python -m"
        # as mentioned at the top of this program.
        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        # Variables that will hold sprite lists
        self.player_list = None

        # Set up the player info
        self.player_sprite = None

        # Set the background color
        arcade.set_background_color(arcade.color.AMAZON)
github pvcraven / arcade / arcade / examples / particle_systems.py View on Github external
def __init__(self):
        super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)

        # Set the working directory (where we expect to find files) to the same
        # directory this .py file is in. You can leave this out of your own
        # code, but it is needed to easily run the examples using "python -m"
        # as mentioned at the top of this program.
        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        arcade.set_background_color(arcade.color.BLACK)

        # collect particle factory functions
        self.factories = [v for k, v in globals().items() if k.startswith("emitter_")]

        self.emitter_factory_id = -1
        self.label = None
        self.emitter = None
        self.emitter_timeout = 0
        self.obj = arcade.Sprite(":resources:images/pinball/bumper.png", 0.2, center_x=0, center_y=15)
        self.obj.change_x = 3
        self.frametime_plotter = FrametimePlotter()
        pyglet.clock.schedule_once(self.next_emitter, QUIET_BETWEEN_SPAWNS)
github pvcraven / arcade / arcade / examples / gui_text_button.py View on Github external
def __init__(self,
                 center_x, center_y,
                 width, height,
                 text,
                 font_size=18,
                 font_face="Arial",
                 face_color=arcade.color.LIGHT_GRAY,
                 highlight_color=arcade.color.WHITE,
                 shadow_color=arcade.color.GRAY,
                 button_height=2):
        self.center_x = center_x
        self.center_y = center_y
        self.width = width
        self.height = height
        self.text = text
        self.font_size = font_size
        self.font_face = font_face
        self.pressed = False
        self.face_color = face_color
        self.highlight_color = highlight_color
        self.shadow_color = shadow_color
        self.button_height = button_height
github pvcraven / arcade / arcade / examples / drawing_with_functions.py View on Github external
"""
    This function draws the background. Specifically, the sky and ground.
    """
    # Draw the sky in the top two-thirds
    arcade.draw_lrtb_rectangle_filled(0,
                                      SCREEN_WIDTH,
                                      SCREEN_HEIGHT,
                                      SCREEN_HEIGHT * (1 / 3),
                                      arcade.color.SKY_BLUE)

    # Draw the ground in the bottom third
    arcade.draw_lrtb_rectangle_filled(0,
                                      SCREEN_WIDTH,
                                      SCREEN_HEIGHT / 3,
                                      0,
                                      arcade.color.DARK_SPRING_GREEN)
github pvcraven / arcade_book / source / chapters / 08_drawing_with_functions / animate_2.py View on Github external
def main():
    arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing with Functions")
    arcade.set_background_color(arcade.color.DARK_BLUE)

    # Call on_draw every 60th of a second.
    arcade.schedule(on_draw, 1/60)
    arcade.run()
github pvcraven / arcade / arcade / examples / procedural_caves.py View on Github external
arcade.draw_text(output,
                         self.view_left + 20,
                         WINDOW_HEIGHT - 20 + self.view_bottom,
                         arcade.color.WHITE, 16)

        output = f"Drawing time: {self.draw_time:.3f}"
        arcade.draw_text(output,
                         self.view_left + 20,
                         WINDOW_HEIGHT - 40 + self.view_bottom,
                         arcade.color.WHITE, 16)

        output = f"Processing time: {self.processing_time:.3f}"
        arcade.draw_text(output,
                         self.view_left + 20,
                         WINDOW_HEIGHT - 60 + self.view_bottom,
                         arcade.color.WHITE, 16)

        self.draw_time = timeit.default_timer() - draw_start_time
github pvcraven / arcade / arcade / examples / gui_text_box.py View on Github external
def setup(self):
        arcade.set_background_color(arcade.color.AMETHYST)
        self.text_list.append(arcade.gui.Text("Name: ", self.center_x - 225, self.center_y))
        self.textbox_list.append(arcade.gui.TextBox(self.center_x - 125, self.center_y))
        self.button_list.append(arcade.gui.SubmitButton(self.textbox_list[0], self.on_submit, self.center_x,
                                                        self.center_y))
github pvcraven / arcade / examples / resizable_window.py View on Github external
def __init__(self, width, height):
        super().__init__(width, height, title="Resizing Window Example", resizable=True)

        arcade.set_background_color(arcade.color.WHITE)
github pvcraven / arcade / arcade / examples / nested_loops_top_left_triangle.py View on Github external
arcade.set_background_color(arcade.color.WHITE)

# Start the render process. This must be done before any drawing commands.
arcade.start_render()

# Loop for each row
for row in range(10):
    # Loop for each column
    # Change the number of columns depending on the row we are in
    for column in range(row):
        # Calculate our location
        x = column * COLUMN_SPACING + LEFT_MARGIN
        y = row * ROW_SPACING + BOTTOM_MARGIN

        # Draw the item
        arcade.draw_circle_filled(x, y, 7, arcade.color.AO)

# Finish the render.
arcade.finish_render()

# Keep the window up until someone closes it.
arcade.run()