完成棋子的格子化

develop
huangjielun 3 years ago
parent 9468e40ac6
commit 9ac29b868d

@ -101,12 +101,21 @@ def main():
elif event.type == pygame.MOUSEBUTTONDOWN:
mouse_x , mouse_y= event.pos
x = int(mouse_x / WIDTH * 9) + 1
y = int(mouse_y / HEIGHT * 6) + 1
y = int(mouse_y / HEIGHT * 7) + 1
b1,b2,b3 = pygame.mouse.get_pressed()
print(mouse_x,mouse_y)
if status == 1:
fox.x = mouse_x
fox.y = mouse_y
if mouse_x >=800:
fox.x = int((x-1) / 9 * WIDTH) - 10
fox.y = int((y-1) / 7 * HEIGHT)
elif mouse_x >=600:
fox.x = int((x - 1) / 9 * WIDTH)
fox.y = int((y - 1) / 7 * HEIGHT)
else:
fox.x = int((x - 1) / 9 * WIDTH) + 15
fox.y = int((y - 1) / 7 * HEIGHT)
if mouse_y >= 500:
fox.y -= 15
status = 0
else :
status = 1

Loading…
Cancel
Save