Commit 6b4375db by BellCodeEditor

auto save

parent d5cb2534
Showing with 1 additions and 20 deletions
...@@ -12,31 +12,12 @@ background = pygame.image.load('bg.png') ...@@ -12,31 +12,12 @@ background = pygame.image.load('bg.png')
right = pygame.image.load('right.png') right = pygame.image.load('right.png')
food = pygame.image.load('apple.png') food = pygame.image.load('apple.png')
body = pygame.image.load('body.png') body = pygame.image.load('body.png')
up=pygame.image.load('up.png')
down = pygame.image.load('down.png')
left=pygame.image.load('left.png')
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event.down==locals.K_DOWN:
if se and K_LEFT !="left":
se="left"
if se and K_LEFT !="right":
se="right"
if se and K_LEFT !="up":
se="up"
if se and K_LEFT !="down":
se="down"
if se=="left":
x-=30
elif se=="right":
x+=30
elif se=="up":
y-=30
elif se=="down":
y+=30
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 将贪吃蛇画上去 # 将贪吃蛇画上去
......
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