|
|
@ -54,12 +54,12 @@ def drawBoard(screen):#绘制棋盘:格子,河流,陷阱,巢穴
|
|
|
|
#colors = [(255, 255, 255), (0, 0, 0)]
|
|
|
|
#colors = [(255, 255, 255), (0, 0, 0)]
|
|
|
|
for row in range(DIMENSION_ROWS):
|
|
|
|
for row in range(DIMENSION_ROWS):
|
|
|
|
for column in range(DIMENSION_COLUMNS):
|
|
|
|
for column in range(DIMENSION_COLUMNS):
|
|
|
|
pg.draw.rect(screen, pg.Color(10,100,10), pg.Rect(bias_left+column * SIZE, bias_top+row * SIZE, SIZE, SIZE))
|
|
|
|
pg.draw.rect(screen, pg.Color(199,237,204), pg.Rect(bias_left+column * SIZE, bias_top+row * SIZE, SIZE, SIZE))
|
|
|
|
pg.draw.rect(screen, pg.Color(90,150,75), pg.Rect((column * SIZE) + bias_left+3, (row * SIZE) + 3+bias_top, SIZE - 4, SIZE - 4))
|
|
|
|
pg.draw.rect(screen, pg.Color(90,150,75), pg.Rect((column * SIZE) + bias_left+3, (row * SIZE) + 3+bias_top, SIZE - 4, SIZE - 4))
|
|
|
|
#画河流
|
|
|
|
#画河流
|
|
|
|
for row in [1,2,4,5]:
|
|
|
|
for row in [1,2,4,5]:
|
|
|
|
for column in [3,4,5]:
|
|
|
|
for column in [3,4,5]:
|
|
|
|
pg.draw.rect(screen, pg.Color(5,5,100),pg.Rect((column * SIZE) +bias_left+3, (row * SIZE) +bias_top +3, SIZE,SIZE))
|
|
|
|
pg.draw.rect(screen, pg.Color(67,142,219),pg.Rect((column * SIZE) +bias_left+2, (row * SIZE) +bias_top +3, SIZE-2,SIZE-2))
|
|
|
|
|
|
|
|
|
|
|
|
#画陷阱
|
|
|
|
#画陷阱
|
|
|
|
for row in [2,4]:
|
|
|
|
for row in [2,4]:
|
|
|
@ -164,12 +164,14 @@ Please type one of the numbers below to choose a playing mode:
|
|
|
|
def showGameOverText(screen, text):
|
|
|
|
def showGameOverText(screen, text):
|
|
|
|
#游戏结束,出现的文字 text是字符串“Left Win”或“Right Win”
|
|
|
|
#游戏结束,出现的文字 text是字符串“Left Win”或“Right Win”
|
|
|
|
font = pg.font.SysFont("comicsansms", 32)
|
|
|
|
font = pg.font.SysFont("comicsansms", 32)
|
|
|
|
text_object = font.render(text, True, pg.Color("red"))
|
|
|
|
text_object = font.render(text, True, pg.Color("grey"))
|
|
|
|
|
|
|
|
|
|
|
|
text_location = pg.Rect(0, 0, BOARD_WIDTH, BOARD_HEIGHT).move(BOARD_WIDTH / 2 - text_object.get_width() / 2,
|
|
|
|
text_location = pg.Rect(0, 0, BOARD_WIDTH, BOARD_HEIGHT).move(BOARD_WIDTH / 2 - text_object.get_width() / 2,
|
|
|
|
BOARD_HEIGHT / 2 - text_object.get_height() / 2)
|
|
|
|
BOARD_HEIGHT / 2 - text_object.get_height() / 2)
|
|
|
|
screen.blit(text_object, text_location)
|
|
|
|
screen.blit(text_object, text_location)
|
|
|
|
text_object = font.render(text, False, pg.Color('black'))
|
|
|
|
text_object = font.render(text, False, pg.Color('red'))
|
|
|
|
screen.blit(text_object, text_location.move(5, 5))
|
|
|
|
screen.blit(text_object, text_location.move(-2 , -2))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def MainMenu():
|
|
|
|
def MainMenu():
|
|
|
|
#显示主菜单
|
|
|
|
#显示主菜单
|
|
|
|