Commit c255fe1b by BellCodeEditor

save project

parent dca9a60a
Showing with 10 additions and 11 deletions
...@@ -28,12 +28,20 @@ while True: ...@@ -28,12 +28,20 @@ while True:
if event.key==locals.K_s and c!="up": if event.key==locals.K_s and c!="up":
c="down" c="down"
d=do d=do
if event.key==locals.K_w and c!="left": if event.key==locals.K_d and c!="left":
c="right" c="right"
d=ri d=ri
if event.key==locals.K_w and c!="right": if event.key==locals.K_a and c!="right":
c="left" c="left"
d=le d=le
if c=="left":
x+=30
elif c=="right":
x-=30
elif c=="up":
y-=30
else:
y+=30
# 将背景图画上去\ # 将背景图画上去\
b.append((x,y)) b.append((x,y))
b.pop(0) b.pop(0)
...@@ -46,14 +54,6 @@ while True: ...@@ -46,14 +54,6 @@ while True:
# 将果实画上去 # 将果实画上去
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
if c=="left":
x+=30
if c=="right":
x-=30
if c=="up":
y-=30
else:
y+=30
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
a.tick(1) a.tick(1)
\ 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