def primitive_create(self):
        circle1 = arcade.create_ellipse_filled(self.x1, self.y1, self.mass1,
                                               self.mass1, self.color)
        circle2 = arcade.create_ellipse_filled(self.x2, self.y2, self.mass2,
                                               self.mass2, self.color)
        line1 = arcade.create_line(self.offsetX, self.offsetY, self.x1,
                                   self.y1, self.color, self.linewidth)
        line2 = arcade.create_line(self.x1, self.y1, self.x2, self.y2,
                                   self.color, self.linewidth)
        trail = arcade.create_line_strip(self.traillist, self.color,
                                         self.trailwidth)

        self.circle1 = arcade.ShapeElementList()
        self.circle1.append(circle1)

        self.circle2 = arcade.ShapeElementList()
        self.circle2.append(circle2)

        self.line1 = arcade.ShapeElementList()
        self.line1.append(line1)

        self.line2 = arcade.ShapeElementList()
        self.line2.append(line2)

        self.trail = arcade.ShapeElementList()
Exemplo n.º 2
0
    def __init__(self):
        # Call the parent class initializer
        super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, "Earth Moon Sun")
        self.sun_x = SCREEN_WIDTH / 2
        self.sun_y = SCREEN_HEIGHT / 2
        self.earth_dist = 180
        self.moon_dist = 40
        self.sun_dia = 20
        self.earth_dia = 10
        self.moon_dia = 5

        self.moon_shape_list = arcade.ShapeElementList()
        moon = arcade.create_ellipse_filled(self.moon_dist, 0,
                                            self.moon_dia, self.moon_dia, arcade.color.WHITE)
        self.moon_shape_list.append(moon)

        self.moon_angle = 0
        self.earth_angle = 0

        self.earth_shape_list = arcade.ShapeElementList()
        sun = arcade.create_ellipse_filled(0, 0,
                                           self.sun_dia, self.sun_dia, arcade.color.YELLOW)
        earth = arcade.create_ellipse_filled(self.earth_dist, 0,
                                             self.earth_dia, self.earth_dia, arcade.color.BRIGHT_GREEN)
        self.earth_shape_list.append(sun)
        self.earth_shape_list.append(earth)

        self.earth_shape_list.center_x = self.sun_x
        self.earth_shape_list.center_y = self.sun_y
        self.moon_shape_list.center_x = self.sun_x + self.earth_dist
        self.moon_shape_list.center_y = self.sun_y
        arcade.set_background_color(arcade.color.DARK_MIDNIGHT_BLUE)
Exemplo n.º 3
0
    def __init__(self, width: int, height: int, players: List[Player]):
        super().__init__(width, height)
        arcade.set_background_color(arcade.color.AMAZON)
        self.game = Game()
        self.scores = [0, 0]
        self.freeze = self.NEW_GAME_FREEZE
        self.players = players

        self.background_list = arcade.ShapeElementList()
        self.background_list.append(
            arcade.create_ellipse_filled(
                *self.translate_point(np.array([0, 0])),
                width=self.game.ARENA_RADIUS * self.SCALE,
                height=self.game.ARENA_RADIUS * self.SCALE,
                color=arcade.color.ORANGE_PEEL))

        self.p_list = [arcade.ShapeElementList() for _ in range(2)]
        self.p_list[0].append(
            arcade.create_ellipse_filled(
                0,
                0,
                width=self.game.PLAYER_RADIUS * self.SCALE,
                height=self.game.PLAYER_RADIUS * self.SCALE,
                color=arcade.color.AERO_BLUE))
        self.p_list[1].append(
            arcade.create_ellipse_filled(
                0,
                0,
                width=self.game.PLAYER_RADIUS * self.SCALE,
                height=self.game.PLAYER_RADIUS * self.SCALE,
                color=arcade.color.ANTIQUE_RUBY))
    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.º 5
0
 def scene3_render(self):
     self.draw_list = arcade.ShapeElementList()
     # self.stars_render()
     self.draw_list.append(
         arcade.create_rectangle_filled(400, 0, 800, 200,
                                        arcade.color.BLUE_GRAY, 0))
     # self.draw_list.append(arcade.create_rectangle_filled(400, 800, 800, 200, arcade.color.BLUE_GRAY, 0))
     self.draw_list.append(
         arcade.create_rectangle_filled(400, 113, 800, 25,
                                        arcade.color.LIGHT_GRAY, 0))
     self.draw_list.append(
         arcade.create_line(2, 0, 2, 124, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(200, 0, 200, 101, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(400, 0, 400, 101, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(600, 0, 600, 101, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(798, 0, 798, 124, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(0, 100, 800, 100, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(0, 124, 800, 124, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_rectangle_outline(100 + (self.battle_cursor * 200),
                                         50, 175, 75, colors["black"], 3))
     self.draw_list.append(
         arcade.create_ellipse_outline(400, 600, self.enemy.size_x,
                                       self.enemy.size_y, colors["db"], 4))
     self.draw_list.append(
         arcade.create_ellipse_filled(400, 600, self.enemy.size_x / 3,
                                      self.enemy.size_y / 3, colors["sky"]))
Exemplo n.º 6
0
    def generate_star_list(self):
        new_universe = []
        new_star_list = arcade.ShapeElementList()

        # procedurally generate all the StarSystem objects on the screen and store as VBOs
        for x in range(0, SECTORS_X):
            # a row of sectors, will be appended to self.universe
            row = []
            for y in range(0, SECTORS_Y):
                seed_x = int(self.galaxy_offset["x"]) + x
                seed_y = int(self.galaxy_offset["y"]) + y

                s = StarSystem(seed_x, seed_y)
                row.append(s)

                if s.star_exists:
                    star = arcade.create_ellipse_filled(x * SECTOR_SIZE,
                                                        y * SECTOR_SIZE,
                                                        s.star_diameter,
                                                        s.star_diameter,
                                                        s.star_color)
                    new_star_list.append(star)

            new_universe.append(row)

        self.universe = new_universe
        self.star_list = new_star_list
Exemplo n.º 7
0
    def build_map_items(self):
        shape_list = arcade.ShapeElementList()
        # targets (blue)
        for target in self.world.map.targets:
            shape_list.append(
                arcade.create_rectangle_filled(target.x + 0.5,
                                               target.y + 0.5,
                                               2,
                                               2,
                                               color=(0, 0, 255)))

        # towers (red)
        for tower in self.world.map.towers:
            shape_list.append(
                arcade.create_rectangle_filled(tower.x + 0.5,
                                               tower.y + 0.5,
                                               2,
                                               2,
                                               color=(255, 0, 0)))

        # communication markers (circles)
        for marker in self.world.map.markers:
            shape_list.append(
                arcade.create_ellipse_filled(marker.location.x + 0.5,
                                             marker.location.y + 0.5,
                                             1,
                                             1,
                                             color=(255, 0, 255)))

        # TODO: self.gates

        self.map_items = shape_list
Exemplo n.º 8
0
    def __init__(self, x, y, width, height, angle):
        alpha = 96
        if random.choice((True, True)):
            self.color = random.choice((
                arcade.color.RED + (alpha, ),
                arcade.color.BLUE + (alpha, ),
                arcade.color.YELLOW + (alpha, ),
            ))
        else:
            self.color = random.choice((
                arcade.color.RED + (alpha, ),
                arcade.color.RED + (alpha, ),
                arcade.color.RED + (alpha, ),
                arcade.color.BLUE + (alpha, ),
                arcade.color.BLUE + (alpha, ),
                arcade.color.BLUE + (alpha, ),
                arcade.color.WHITE + (alpha, ),
            ))

        self.x = x
        self.y = y
        self.angle = angle
        self.delta_angle = random.uniform(0.2, 0.6)
        shape = arcade.create_ellipse_filled(0, 0, width, height, self.color,
                                             0)
        self.shape_list = arcade.ShapeElementList()
        self.shape_list.append(shape)
        self.shape_list.center_x = self.x
        self.shape_list.center_y = self.y
Exemplo n.º 9
0
 def draw(self, game, x, y):
     game.draw_list.append(
         arcade.create_ellipse_outline(x, y, self.size_x, self.size_y,
                                       colors["db"], 4))
     game.draw_list.append(
         arcade.create_ellipse_filled(x, y, self.size_x / 3,
                                      self.size_y / 3, colors["sky"]))
Exemplo n.º 10
0
def make_big_hills():
    shape_list = arcade.ShapeElementList()
    for i in range(3):
        shape = arcade.create_ellipse_filled(i * 400, 60, 200, 200,
                                             (129, 122, 198))
        shape_list.append(shape)
    return shape_list
Exemplo n.º 11
0
def make_small_hills():
    shape_list = arcade.ShapeElementList()
    for i in range(6):
        shape = arcade.create_ellipse_filled(i * 200, 60, 100, 100,
                                             (146, 82, 161))
        shape_list.append(shape)
    return shape_list
Exemplo n.º 12
0
    def update(self, board):
        width = Square.WIDTH
        height = Square.HEIGHT
        margin = Square.MARGIN

        for shape in self:
            self.remove(shape)

        for row in board.state:
            for square in row:
                color = None
                if square.player_state == SquarePlayerState.CHECKER_RED:
                    color = arcade.color.RED
                elif square.player_state == SquarePlayerState.CHECKER_BLUE:
                    color = arcade.color.BLUE
                
                if square.player_state != SquarePlayerState.EMPTY:
                    current_cir = arcade.create_ellipse_filled(
                        (margin + width) * square.column + margin + width // 2,
                        (margin + height) * square.row + margin + height // 2,
                        30,
                        30,
                        color
                    )
                    self.append(current_cir)
Exemplo n.º 13
0
def make_person(head_radius, chest_height, chest_width, leg_width, leg_height,
                arm_width, arm_length, arm_gap, shoulder_height):

    shape_list = arcade.ShapeElementList()

    # Head
    shape = arcade.create_ellipse_filled(0, chest_height / 2 + head_radius,
                                         head_radius, head_radius,
                                         arcade.color.WHITE)
    shape_list.append(shape)

    # Chest
    shape = arcade.create_rectangle_filled(0, 0, chest_width, chest_height,
                                           arcade.color.BLACK)
    shape_list.append(shape)

    # Left leg
    shape = arcade.create_rectangle_filled(
        -(chest_width / 2) + leg_width / 2,
        -(chest_height / 2) - leg_height / 2, leg_width, leg_height,
        arcade.color.RED)
    shape_list.append(shape)

    # Right leg
    shape = arcade.create_rectangle_filled(
        (chest_width / 2) - leg_width / 2,
        -(chest_height / 2) - leg_height / 2, leg_width, leg_height,
        arcade.color.RED)
    shape_list.append(shape)

    # Left arm
    shape = arcade.create_rectangle_filled(
        -(chest_width / 2) - arm_width / 2 - arm_gap,
        (chest_height / 2) - arm_length / 2 - shoulder_height, arm_width,
        arm_length, arcade.color.BLUE)
    shape_list.append(shape)

    # Left shoulder
    shape = arcade.create_rectangle_filled(
        -(chest_width / 2) - (arm_gap + arm_width) / 2,
        (chest_height / 2) - shoulder_height / 2, arm_gap + arm_width,
        shoulder_height, arcade.color.BLUE_BELL)
    shape_list.append(shape)

    # Right arm
    shape = arcade.create_rectangle_filled(
        (chest_width / 2) + arm_width / 2 + arm_gap,
        (chest_height / 2) - arm_length / 2 - shoulder_height, arm_width,
        arm_length, arcade.color.BLUE)
    shape_list.append(shape)

    # Right shoulder
    shape = arcade.create_rectangle_filled(
        (chest_width / 2) + (arm_gap + arm_width) / 2,
        (chest_height / 2) - shoulder_height / 2, arm_gap + arm_width,
        shoulder_height, arcade.color.BLUE_BELL)
    shape_list.append(shape)

    return shape_list
Exemplo n.º 14
0
 def __init__(self, x, y, size,color, kind):
     self.x = x
     self.y = y
     self.kind = kind
     if self.kind == 0:
         self.shape = arcade.create_rectangle_filled(self.x, self.y, size, size, color)
     else:
         self.shape = arcade.create_ellipse_filled(self.x, self.y, size / 2, size / 2, color)
Exemplo n.º 15
0
 def create_Zbiggy(self):
     self.Zbiggi = arcade.ShapeElementList()
     for ex, ey in self.engine.enemies:
         self.Zbiggi.append(
             arcade.create_ellipse_filled(
                 (ex + 0.5) * self.SQUARE_WIDTH,
                 (ey + 0.5) * self.SQUARE_HEIGHT, self.SQUARE_WIDTH / 2,
                 self.SQUARE_HEIGHT / 2, ZBIGGY_COLOR))
 def __init__(self, xpos, ypos):
     self._radius = 17.5
     super().__init__(xpos, ypos, self._radius, self._radius, 0,
                      arcade.color.BLUE)
     shape = arcade.create_ellipse_filled(0, 0, self.width, self.height,
                                          self.color, self.angle)
     self.shape_list = arcade.ShapeElementList()
     self.shape_list.append(shape)
Exemplo n.º 17
0
    def render(self, et, dt):

        if self.shapes is None:

            self.shapes = arcade.ShapeElementList()

            for m in self.markers:
                (x, y) = self.map.project(m[0])
                self.shapes.append(
                    arcade.create_line(x, y, x, y + 24, (0, 0, 0, 128), 4))
                self.shapes.append(
                    arcade.create_ellipse_filled(x, y, 4, 4, (0, 0, 0, 128), 0,
                                                 18))
                self.shapes.append(
                    arcade.create_ellipse_filled(x, y + 24, 8, 8,
                                                 arcade.color.AMAZON, 0, 18))

        self.shapes.draw()
Exemplo n.º 18
0
 def set_wall(self, row, col):
     spot = self.spots[row][col]
     self.spots_list[row * DIV + col] = arcade.create_ellipse_filled(
         spot.x * G_W + G_W / 2, spot.y * G_H + G_H / 2, 3, 3,
         arcade.color.RED)
     self.spots[row][col].set_wall()
     self.obstacles.append(
         pymunk.Vec2d(spot.x * G_W + G_W / 2, spot.y * G_H + G_H / 2))
     self.__recalculate_grid()
    def __init__(self, x, y, width, height, angle, delta_x, delta_y,
                 delta_angle, color):

        super().__init__(x, y, width, height, angle, delta_x, delta_y,
                         delta_angle, color)

        shape = arcade.create_ellipse_filled(0, 0, self.width, self.height,
                                             self.color, self.angle)
        self.shape_list = arcade.ShapeElementList()
        self.shape_list.append(shape)
Exemplo n.º 20
0
 def __init__(self, xpos, ypos):
     self._radius = AGENT_RADIUS
     super().__init__(xpos, ypos, self._radius, self._radius, 0,
                      arcade.color.BLUE)
     shape = arcade.create_ellipse_filled(0, 0, self.width, self.height,
                                          self.color, self.angle)
     lin = arcade.create_line(0, 0, 0 + self._radius, 0, arcade.color.WHITE,
                              5)
     self.shape_list = arcade.ShapeElementList()
     self.shape_list.append(shape)
     self.shape_list.append(lin)
Exemplo n.º 21
0
    def render(self, et, dt):

        if self.shapes is None:

            self.shapes = arcade.ShapeElementList()
            l = None
            for e in self.waypoints.points:
                n = self.map.project(e[0])
                if l is not None:
                    self.shapes.append(
                        arcade.create_line_strip((l, n), (0, 40, 150, 64), 3))
                rx, ry = self.map.project_radius(e[0], self.waypoints.radius)
                self.shapes.append(
                    arcade.create_ellipse_filled(*n, rx, ry, (0, 40, 150, 32),
                                                 0, 18))
                self.shapes.append(
                    arcade.create_ellipse_filled(*n, 5, 5, (0, 40, 150, 128),
                                                 0, 9))
                l = n

        self.shapes.draw()
Exemplo n.º 22
0
 def _create_shape(self, scale) -> Shape:
     """
     Create a shape representing this lake.
     :return: a Arcade shape object.
     """
     if self.hole is not None:
         points = self._create_points(scale)
         return create_line_strip(points, self.color,
                                  self.border_width * scale)
     return create_ellipse_filled(self.center_x, self.center_y,
                                  self.outer_radius * scale,
                                  self.outer_radius * scale, self.color)
    def __init__(self, xpos, ypos):
        self._radius = BOT_RADIUS
        super().__init__(xpos, ypos, self._radius, self._radius, 0,
                         arcade.color.GREEN)
        shape = arcade.create_ellipse_filled(0, 0, self.width, self.height,
                                             self.color, self.angle)
        self.shape_list = arcade.ShapeElementList()
        self.shape_list.append(shape)

        point_list = ((self.x, self.y), (self.x + 10, self.y + 10),
                      (self.x + 14, self.y + 18))
        self.planned_path = Line(point_list)
Exemplo n.º 24
0
def draw_map(bodies, window_width, window_height):

    map_shape_list = arcade.ShapeElementList()

    view = arcade.get_viewport()
    map_width = window_width / 3.5
    map_height = window_height / 3.5
    map_padding = window_height / 80
    map_center_x = view[1] - (map_width / 2 + map_padding)
    map_center_y = view[2] + (map_height / 2 + map_padding)
    #view[0] = left, view[1] = right, view[2] = bottom, view[3] = top
    rec = arcade.create_rectangle_filled(map_center_x, map_center_y, map_width,
                                         map_height, arcade.color.BLACK)
    rec2 = arcade.create_rectangle_outline(map_center_x, map_center_y,
                                           map_width, map_height,
                                           arcade.color.WHITE,
                                           window_width / 400)

    map_shape_list.append(rec)
    map_shape_list.append(rec2)

    max_mass = 0
    cm = None  # find_center_of_mass(bodies)
    for bodie in bodies:
        if max_mass < bodie.mass:
            max_mass = bodie.mass
            cm = bodie.pos

    max_dist = 1
    for bodie in bodies:
        this_dist = (cm - bodie.pos).get_mag()
        if max_dist < this_dist:
            max_dist = this_dist

    scaler = max_dist / ((map_height - map_padding) / 2)
    # print(scaler)
    # scaler = 60

    for bodie in bodies:
        map_pos = (bodie.pos - cm)
        map_pos.x /= scaler
        map_pos.y /= scaler
        map_pos += Vec2D(map_center_x, map_center_y)
        map_shape_list.append(
            arcade.create_ellipse_filled(map_pos.x, map_pos.y,
                                         window_width / 300,
                                         window_width / 300, bodie.color))
        # map_shpe_list.append( arcade. )

    map_shape_list.draw()
Exemplo n.º 25
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)
def make_shape():

    shape_list = arcade.ShapeElementList()

    # Shape center around which we will rotate
    center_x = 20
    center_y = 30

    width = 30
    height = 40

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

    return shape_list
Exemplo n.º 27
0
    def update(self, delta_time, walls, ball, my_gate, enemy_gate, team_player, enemy_1, enemy_2):
        self.batches = defaultdict(_Batch)
        distances = np.min(self.distances(walls), axis=1)
        cut_sensors = np.multiply(np.resize(distances, (N_SENSORS, 1)), self.sensors)

        for [sx, sy, ex, ey] in cut_sensors:
            self.append(arcade.create_line(sx, sy, ex, ey, color=self.g_color))

        circ = arcade.create_ellipse_filled(0, 0, width=20, height=20, color=self.color)

        self.append(circ)
        self.append(circ)

        self.holding_ball = self.check_for_collision_with_ball(ball)
        self.on_wall = np.min(distances) < 0.05

        return self.generate_input(distances, ball, my_gate, enemy_gate, team_player, enemy_1, enemy_2)
Exemplo n.º 28
0
    def setup_draw(self):
        '''
        Creating the inital shapes to be rendered later by the BoxCar class.
        '''

        self.visuals.center_x = self.body.position.x
        self.visuals.center_y = self.body.position.y

        # Draws the wheel
        shape = arcade.create_ellipse_filled(0, 0, self.radius, self.radius,
                                             arcade.color.GRAY)
        self.visuals.append(shape)

        # Draws the orientation of wheel
        end = self.body.rotation_vector * self.radius
        shape = arcade.create_line(0, 0, end.x, end.y, arcade.color.BLACK, 2)
        self.visuals.append(shape)
Exemplo n.º 29
0
 def follow_path(self):
     if self.following_path:
         if self.boundaries[self.path_index].has_crossed_line(
                 self.body.position):
             if self.path[self.path_index] == self.goal:
                 target = self.path[self.path_index]
                 self.__slow_down(target)
             else:
                 self.path_index += 1
         if self.following_path:
             target = self.path[self.path_index]
             self.__seek(target)
             self.debug.append(
                 arcade.create_ellipse_filled(
                     target.x, target.y, 4, 4,
                     arcade.color.BANGLADESH_GREEN))
     return self.following_path
Exemplo n.º 30
0
def make_clouds():
    shape_list = arcade.ShapeElementList()
    shape_list.center_x = SCREEN_WIDTH / 2
    for i in range(4):
        if i == 0:
            x = shape_list.center_x
            y = SCREEN_HEIGHT - 100
        elif i == 1:
            x = shape_list.center_x
            y = SCREEN_HEIGHT - 150
        elif i == 2:
            x = shape_list.center_x - 50
            y = SCREEN_HEIGHT - 150
        else:
            x = shape_list.center_x + 50
            y = SCREEN_HEIGHT - 150
        shape = arcade.create_ellipse_filled(x, y, 50, 50, (255, 255, 255))
        shape_list.append(shape)
    return shape_list