源碼說明 一款使用pygame制作的拼圖游戲,有多種方式選擇 5×5,4×4,3×3 一、運行效果![圖片](http://image109.360doc.com/DownloadImg/2022/02/1113/239254439_2_20220211013719819.png)
![圖片](http://image109.360doc.com/DownloadImg/2022/02/1113/239254439_3_2022021101372285.png)
二、部分示例代碼![圖片](http://image109.360doc.com/DownloadImg/2022/02/1113/239254439_4_20220211013722788.jpeg)
'''顯示游戲開始界面''' def ShowStartInterface(screen, width, height): screen.fill(BACKGROUNDCOLOR) tfont = pygame.font.Font('./font/simkai.ttf', width//4) cfont = pygame.font.Font('./font/simkai.ttf', width//20) title = tfont.render('拼圖游戲', True, RED) content1 = cfont.render('按H或M或L鍵開始游戲', True, BLUE) content2 = cfont.render('H為5*5模式,M為4*4模式,L為3*3模式', True, BLUE) trect = title.get_rect() trect.midtop = (width/2, height/10) crect1 = content1.get_rect() crect1.midtop = (width/2, height/2.2) crect2 = content2.get_rect() crect2.midtop = (width/2, height/1.8) screen.blit(title, trect) screen.blit(content1, crect1) screen.blit(content2, crect2) pygame.display.update()
|