python初学,贪吃蛇完整代码记录

python初学,贪吃蛇完整代码记录,第1张

python初学,贪吃蛇完整代码记录

跟着B站up主做的,权当是仓库记录一下,效果直接粘贴跑下就好了

import turtle
from random import randrange
snake = [[0,0],[0,10],[0,20]]
aim = [0,10]
food = [-10,0]

def change_direction(x,y):
    aim[0] = x
    aim[1] = y

def square(x,y,size,color):
    turtle.penup()
    turtle.goto(x,y)
    turtle.pendown()
    turtle.color(color)
    turtle.begin_fill()
    for i in range(4):
        turtle.forward(size)
        turtle.left(90)
        turtle.end_fill()
def inside(head):
    return -250					
										


					

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5495655.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-12
下一篇 2022-12-12

发表评论

登录后才能评论

评论列表(0条)

保存