def convert_mouse_pos_to_board_loc(self, x, y):
     pt = arcade.Point(x, y)
     collision_list = arcade.get_sprites_at_point(pt, self.board)
     if collision_list != []:
         return collision_list[0].cell_id
     else:
         return None
Beispiel #2
0
 def on_mouse_release(self, x, y, button, modifiers):
     super().on_mouse_release(x, y, button, modifiers)
     print("mouse", x, y)
     if self.MenuSprite.collides_with_point(arcade.Point(x, y)):
         if len(self.button_list) == 5:
             if self.button_list[-1].check_mouse_inside(x, y):
                 return
         res = self.client.send_data({"TYPE": "SEATCANCELREQUEST"})
Beispiel #3
0
 def setup(self):
     self.cities = []
     for i in range(self.num_cities):
         city = arcade.Point(randint(0, SCREEN_WIDTH - 1),
                             randint(0, SCREEN_HEIGHT - 1))
         self.cities.append(city)
     self.shortest = self.get_total_dist(self.cities)
     self.permutations = list(permutations(self.cities))
     self.current_permutation = 0
     self.start_time = time.time()
     self.done = False
    def setup(self):
        self.cities = []

        for i in range(self.num_cities):
            city = arcade.Point(randint(0, SCREEN_WIDTH - 1),
                                randint(0, SCREEN_HEIGHT - 1))
            self.cities.append(city)

        self.unvisited = copy.deepcopy(self.cities)
        self.path = [self.unvisited.pop()]
        # remove element at index 0
        self.start_time = time.time()
        self.curr_city = 0
        self.done = False
Beispiel #5
0
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)

on_draw.text = arcade.Text("Hello!!", 250, 300, 100, arcade.color.CHESTNUT)
shapes.append(on_draw.text)

on_draw.triangle = arcade.Triangle(40, 99, 100, 50, 55, 150,
                                   arcade.color.MAROON)
on_draw.triangle.change_x = 2
on_draw.triangle.change_y = 4
shapes.append(on_draw.triangle)

points = ([19, 24], [33, 107], [15, 66], [100, 75], [100, 90])
on_draw.polygon = arcade.Polygon(points, arcade.color.CYAN)
on_draw.polygon.change_x = 6