Commit 1807262d by BellCodeEditor

auto save

parent eeb5969a
Showing with 27 additions and 19 deletions
import turtle
a=turtle.Pen()
screen=turtle.Screen()
a.speed(100)
a.hideturtle()
screen.bgcolor('black')
i=0 while True:
while i<200: for event in pygame.event.get():
a.pencolor('pink') if event.type == locals.QUIT:
a.penup() # 接收到退出事件后退出程序
a.goto(0,0) exit()
a.forward(200) if x == apple_x and y == apple_y:
a.pendown() num1 = random.randint(1,22)
a.circle(100) num2 = random.randint(1,16)
a.left(2) apple_x = 30*num1-30
i+=1 apple_y = 30*num2-30
else:
turtle.done() position.pop(0)
\ No newline at end of file if x < 0 or x > 630 or y < 0 or y > 450:
exit()
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
screen.blit(right, (240, 120))
# 将贪吃蛇的身体画上去
screen.blit(body, (210, 120))
screen.blit(body, (180, 120))
screen.blit(body, (180, 90))
# 将果实画上去
screen.blit(food, (360, 300))
# 刷新画面
pygame.display.update()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment