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 i<200:
a.pencolor('pink')
a.penup()
a.goto(0,0)
a.forward(200)
a.pendown()
a.circle(100)
a.left(2)
i+=1
turtle.done()
\ No newline at end of file
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if x == apple_x and y == apple_y:
num1 = random.randint(1,22)
num2 = random.randint(1,16)
apple_x = 30*num1-30
apple_y = 30*num2-30
else:
position.pop(0)
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