# Conflicts:
#	src/main.py
#	src/main_an.py
develop
Mix 3 years ago
commit 82cc676dc1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@ -172,19 +172,19 @@ def clac_MAP1():
return MAP
def refresh():
l_elephant = pygame.Rect(281, 10, CHESSSIZE_Y, CHESSSIZE_Y)
l_eagle = pygame.Rect(157, 120, CHESSSIZE_Y, CHESSSIZE_Y)
l_wolf = pygame.Rect(284, 229, CHESSSIZE_Y, CHESSSIZE_Y)
l_lion = pygame.Rect(292, 343, CHESSSIZE_Y, CHESSSIZE_Y)
l_leopard = pygame.Rect(285, 450, CHESSSIZE_Y, CHESSSIZE_Y)
l_mouse = pygame.Rect(285, 665, CHESSSIZE_Y, CHESSSIZE_Y)
l_fox = pygame.Rect(157, 557, CHESSSIZE_Y, CHESSSIZE_Y)
l_elephant = pygame.Rect(int(2 / 9 * WIDTH), int(0 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
l_eagle = pygame.Rect(int(1 / 9 * WIDTH), int(1 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
l_wolf = pygame.Rect(int(2 / 9 * WIDTH), int(2 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
l_lion = pygame.Rect(int(2 / 9 * WIDTH), int(3 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
l_leopard = pygame.Rect(int(2 / 9 * WIDTH), int(4 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
l_mouse = pygame.Rect(int(2 / 9 * WIDTH), int(6 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
l_fox = pygame.Rect(int(1 / 9 * WIDTH), int(5 / 7 * HEIGHT), CHESSSIZE_Y,CHESSSIZE_Y)
r_elephant = pygame.Rect(795, 673, CHESSSIZE_Y, CHESSSIZE_Y)
r_eagle = pygame.Rect(925, 570, CHESSSIZE_Y, CHESSSIZE_Y)
r_wolf = pygame.Rect(803, 458, CHESSSIZE_Y, CHESSSIZE_Y)
r_lion = pygame.Rect(802, 347, CHESSSIZE_Y, CHESSSIZE_Y)
r_leopard = pygame.Rect(796, 232, CHESSSIZE_Y, CHESSSIZE_Y)
r_fox = pygame.Rect(920, 123, CHESSSIZE_Y, CHESSSIZE_Y)
r_mouse = pygame.Rect(793, 16, CHESSSIZE_Y, CHESSSIZE_Y)
r_elephant = pygame.Rect(int(6 / 9 * WIDTH), int(6 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
r_eagle = pygame.Rect(int(7 / 9 * WIDTH), int(5 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
r_wolf = pygame.Rect(int(6 / 9 * WIDTH), int(4 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
r_lion = pygame.Rect(int(6 / 9 * WIDTH), int(3 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
r_leopard = pygame.Rect(int(6 / 9 * WIDTH), int(2 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
r_fox = pygame.Rect(int(7 / 9 * WIDTH), int(1 / 7 * HEIGHT), CHESSSIZE_Y,CHESSSIZE_Y)
r_mouse = pygame.Rect(int(6 / 9 * WIDTH), int(0 / 7 * HEIGHT), CHESSSIZE_Y, CHESSSIZE_Y)
return l_elephant,l_eagle,l_wolf, l_lion,l_leopard, l_mouse,l_fox,r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_fox,r_mouse

@ -3,7 +3,6 @@ import init
import start_game
import time
import os
#import path.path
WIDTH , HEIGHT = 1200 , 800
@ -30,6 +29,11 @@ Fox = pygame.mixer.Sound('audio/Fox..mp3')
Eagle = pygame.mixer.Sound('audio/Eagle.mp3')
pygame.mixer.music.set_volume(0.5)
####################################################
#mark
hint = pygame.transform.scale(pygame.image.load("images/hint.png"),(CHESSSIZE_X,CHESSSIZE_Y))
capture_hint = pygame.transform.scale(pygame.image.load("images/capture-hint.png"),(CHESSSIZE_X,CHESSSIZE_Y))
left_turn = pygame.transform.scale(pygame.image.load("images/left_turn.png"),(CHESSSIZE_X,CHESSSIZE_Y))
right_turn = pygame.transform.scale(pygame.image.load("images/right_turn.png"),(CHESSSIZE_X,CHESSSIZE_Y))
#animals img
#Left
L_mouse = pygame.transform.scale(pygame.image.load('images/animals/left/1MouseLeft.png'),(CHESSSIZE_X,CHESSSIZE_Y))
@ -110,11 +114,15 @@ def draw_right_animals(r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox)
WIN.blit(R_fox, (r_fox.x, r_fox.y))
def draw_window(l_elephant,l_eagle,l_wolf,l_lion,l_leopard,l_mouse,l_fox,r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox):
def draw_window(l_elephant,l_eagle,l_wolf,l_lion,l_leopard,l_mouse,l_fox,r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox,id, x, y, status, MAP, MAP1,turn):
WIN.blit(SPACE,(0,0))
if turn == 0:
WIN.blit(left_turn,init.tran(0,3))
elif turn == 1:
WIN.blit(right_turn,init.tran(8,3))
draw_left_animals(l_elephant,l_eagle,l_wolf,l_lion,l_leopard,l_mouse,l_fox)
draw_right_animals(r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox)
#WIN.blit(L_fox,(fox.x,fox.y))
path(id, x, y, status, MAP, MAP1, turn)
pygame.display.update()
#animals rect
@ -919,6 +927,20 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
else :
return 0
def path(id, x, y, status, MAP, MAP1, turn):
if status:
movement = []
for i in range(9):
for j in range(7):
if turn == 0:
if right_move(x, y, i, j, id, MAP,MAP1):
movement.append([i, j])
else:
if left_move(x, y, i, j, id, MAP,MAP1):
movement.append([i, j])
for i, j in movement:
WIN.blit(hint, init.tran(i,j))
WIN.blit(capture_hint,init.tran(x,y))
#TODO:Judge who win
def left_win(x,y,MAP,MAP1):
global r_animals
@ -1560,7 +1582,7 @@ def main():
MAP1 = init.clac_MAP1()
game_status = start_game.starting_screen()
if not game_status:
return True
return False
run = True
clock = pygame.time.Clock()
font = pygame.font.SysFont('kaiti',40)
@ -1787,7 +1809,8 @@ def main():
run = False
if right_win(x,y,MAP,MAP1):
run = False
draw_window(l_elephant,l_eagle,l_wolf,l_lion,l_leopard,l_mouse,l_fox,r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox)
draw_window(l_elephant,l_eagle,l_wolf,l_lion,l_leopard,l_mouse,l_fox,r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox,id, x, y, status, MAP, MAP1,turn)
if left_win(x, y, MAP, MAP1):
print_text(WIN, font, 500, 400, "Left Win!", RED)
pygame.display.update()
@ -1795,6 +1818,7 @@ def main():
print_text(WIN, font, 500, 400, "Right Win!", BLUE)
pygame.display.update()
time.sleep(2)
return start_game.starting_screen()
#os.system("pause")
return start_game.starting_screen()
@ -1803,6 +1827,7 @@ if __name__ == "__main__":
while again == 1:
l_elephant, l_eagle, l_wolf, l_lion, l_leopard, l_mouse, l_fox, r_elephant, r_eagle, r_wolf, r_lion, r_leopard, r_fox, r_mouse=init.refresh()
draw_window(l_elephant, l_eagle, l_wolf, l_lion, l_leopard, l_mouse, l_fox, r_elephant, r_eagle, r_wolf, r_lion,
r_leopard, r_mouse, r_fox)
r_leopard, r_mouse, r_fox,0,0,0,0,0,0,0)
again = main()
ID = [1 for i in range(20)]
pygame.quit()

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save