大家好,又见面了,我是你们的朋友全栈君。
#!.../usr/bin/env python
# -*- coding: utf-8 -*-
import pygame as pygame
import random
import sys
from pygame.rect...((800, 600)) # 创建游戏窗口
pygame.display.set_caption('贪吃蛇') # 窗口名
snakePosition = [80..., 80] # 贪吃蛇的头
snakebody = [[80, 80], [60, 80], [40, 80]] # 初始化贪吃蛇的长度 (注:这里以20*20为一个标准小格子)...,,,就是把蛇行走的身形画出来
pygame.draw.rect(playSurface, self.white, Rect(position[0], position