Commit 4c15d2fb by BellCodeEditor

save project

parent f16b6533
Showing with 6 additions and 6 deletions
......@@ -24,7 +24,7 @@ snake_head = right
aaa=[(180,90),(180,120),(210,120),(x,y)]
while True:
for event in pygame.event.get():
if event.type == KEYDOWN:
if event.type ==locals.KEYDOWN:
if event.key ==locals.K_UP and setheading!="down":
setheading = "up"
snake_head = up
......@@ -37,11 +37,11 @@ while True:
if event.key ==locals.K_LEFT and setheading!="right":
setheading = "left"
snake_head = left
if setheading = "up"
if setheading == "up":
y = y-30
elif setheading = "down"
elif setheading == "down":
y = y+30
elif setheading = "left"
elif setheading == "left":
x = x-30
else:
x = x+30
......@@ -49,7 +49,7 @@ while True:
# 接收到退出事件后退出程序
exit()
# 将背景图画上去
x=x+30
aaa.append((x,y))
aaa.pop(0)
screen.blit(background, (0, 0))
......@@ -65,4 +65,4 @@ while True:
screen.blit(food, (360, 300))
# 刷新画面
pygame.display.update()
a.tick(12)
a.tick(3)
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