snake/main.py

22 lines
499 B
Python
Raw Normal View History

2024-07-14 00:10:48 +08:00
from settings import Settings
import game_functions as gf
import pygame
settings = Settings()
screen = pygame.display.set_mode((settings.width, settings.height)) # 设置屏幕
pygame.display.set_caption('贪吃蛇') # 添加游戏标题
def run_game():
while True:
if settings.game_mode == 0:
gf.show_start(settings, screen)
elif settings.game_mode == -1:
gf.show_end(settings, screen)
if __name__ == "__main__":
pygame.init()
run_game()