def __init__(self, width, height, title):
        super().__init__(width, height, title)
        self.center_window()

        # A batch ami egy ShapeElementList objektum
        self.batch = arcade.ShapeElementList()

        # Ellipses - Ellipszisek
        ellipse1 = arcade.create_ellipse_filled(440, 360, 50, 50,
                                                arcade.color.ROSE)
        ellipse2 = arcade.create_ellipse_outline(640, 360, 50, 80,
                                                 arcade.color.RED)
        ellipse3 = arcade.create_ellipse_filled_with_colors(
            840, 360, 50, 80, arcade.color.RED, arcade.color.BLUE, 45)

        # Triangle - Háromszög
        triangle = arcade.create_polygon([[0, 0], [100, 0], [50, 100]],
                                         arcade.color.BLUE)
        # Rectangle - Téglalap
        rect = arcade.create_rectangle_filled(100, 360, 100, 150,
                                              arcade.color.GREEN)
        # Invisible Rectangle 1 pixel - Láthatalan 1 pixel átmérőjű négyzet
        invisible_rect = arcade.create_rectangle_filled(
            0, 0, 1, 1, arcade.color.BLACK)

        # Itt adjuk hozzá a batch-oz a geometriai alakzatokat
        self.batch.append(ellipse1)
        self.batch.append(ellipse2)
        self.batch.append(ellipse3)
        self.batch.append(triangle)
        self.batch.append(rect)

        # Ezt mindig utoljára adjuk a batch-hoz, amíg a hibát ki nem javítják az Arcade fejlesztői.
        self.batch.append(invisible_rect)
Exemplo n.º 2
0
    def generate_stars(self, min, max, r_min, r_max):
        # Create each star and append to the list.
        number_of_stars = randrange(min, max, step=1)

        for _ in range(number_of_stars):
            x = random() * self.width
            y = random() * self.height
            radius = randrange(r_min, r_max, step=1)
            star = arcade.create_ellipse_filled_with_colors(
                x, y, radius, radius, (0, 0, 0, 0), arcade.color.WHITE)
            self.append(star)
Exemplo n.º 3
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.º 4
0
    def make_kinematic_shape(self):
        # dynamic  circle

        #s = arcade.create_ellipse_filled(0, 0, self.radius, self.radius, ball_color)
        s = arcade.create_ellipse_filled_with_colors(
            0, 0, self.radius, self.radius, arcade.color.GRAY,
            arcade.color.UNMELLOW_YELLOW)
        self.kinematic_shape_element.append(s)
        # dot
        s_radius = int(self.radius * 0.15)
        s = arcade.create_ellipse_filled(self.radius - s_radius * 2, 0,
                                         s_radius, s_radius,
                                         arcade.color.WHITE)
        self.kinematic_shape_element.append(s)
Exemplo n.º 5
0
 def recreate_board(self):
     self.board_shape_list = arcade.ShapeElementList()
     for row in range(BOARD_SIZE):
         for column in range(BOARD_SIZE):
             if self.board_state[row, column]:
                 if self.board_state[row, column] == 1:
                     colors = [(40, 40, 40), (0, 0, 0)]
                 else:
                     colors = [(240, 240, 240), (200, 200, 200)]
                 curr_shape = arcade.create_ellipse_filled_with_colors(
                     center_x=(column + 1) * TILE_SIZE,
                     center_y=(row + 1) * TILE_SIZE,
                     width=TILE_MID // 1.5,
                     height=TILE_MID // 1.5,
                     inside_color=colors[0],
                     outside_color=colors[1])
                 self.board_shape_list.append(curr_shape)
Exemplo n.º 6
0
    def __init__(self, width, height, title):

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

        self.set_update_rate(1 / 100)

        self.set_mouse_visible(False)

        arcade.set_background_color(arcade.color.BLACK)

        self.pumpkin = Bossman(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 2, 0, 0, 40, 20, updownspd, True, 0.85)
        self.mouse = Mouse(300, 300)
        self.candle = Candles(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 2, 0, 40, 20, updownspd, True)

        self.shapes = arcade.ShapeElementList()
        shape = arcade.create_ellipse_filled_with_colors(self.candle.x, self.candle.y + (30 * self.candle.scale)/2 + 6 * self.candle.scale + 14, 90, 90, inside_color=(255, 153, 51), outside_color=(0,0,0))
        self.shapes.append(shape)
Exemplo n.º 7
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