1、制作窗口,插入音频与图片2、绘制蛇与果实3、按键控制4、生成食物5、结束判断
(本程序基于Python3.9.1编写)
首先要导入需要的模块。
import pygame import sys import random from pygame.locals import *