You can now move off bar

This commit is contained in:
Alexander Munch-Hansen 2018-04-14 23:31:33 +02:00
parent 7d29fc02f2
commit f59fe27e5f

View File

@ -135,6 +135,16 @@ class Board_painter:
def find_pin(self, pos):
SPACING = self.SPACING
x,y = pos
if 500 < x < 550:
if y > 225:
pin = 0
idx = 0
else:
pin = 25
idx = 25
else:
x -= 50 if x > 550 else 0
if y < 175:
pin = (13 + int(x / SPACING))
@ -254,6 +264,8 @@ class Board_painter:
if buckets[idx][0] == 0:
buckets[idx][1] = 0
print("Location for mouse_down:", self.from_board)
offsets[is_true][0] = rectangles[is_true].x - mouse_x
offsets[is_true][1] = rectangles[is_true].y - mouse_y
@ -309,7 +321,7 @@ class Board_painter:
# print(move_legal(from_board, buckets, [1,2]))
print("from board:",self.from_board)
# if self.move_legal(self.from_board, buckets, self.roll):
pot_board = self.gen_board_from_buckets(buckets)
sets = self.calc_move_sets(self.from_board, self.roll, player)
@ -404,47 +416,12 @@ class Board_painter:
def test(self):
while True:
self.paint_board()
pygame.quit()
b = Board_painter()
b.test()
# class myThread (threading.Thread):
# def __init__(self, threadID, name, counter):
# threading.Thread.__init__(self)
# self.threadID = threadID
# self.name = name
# self.counter = counter
# def run(self, function):
# print ("Starting " + self.name)
# function()
# print ("Exiting " + self.name)
# def change_player():
# while True:
# time.sleep(5)
# b.switch_player([1,2])
# def keep_painting():
# while True:
# b.paint_board()
# # Create new threads
# thread2 = myThread( keep_painting() )
# thread1 = myThread( change_player() )
# # Start new Threads
# thread1.start()
# thread2.start()
# thread1.join()
# thread2.join()
# print ("Exiting Main Thread")
# # - end -
# pygame.quit()