Commit 7c7209c2 by BellCodeEditor

auto save

parent f1c9d3d4
Showing with 16 additions and 12 deletions
...@@ -18,8 +18,9 @@ down = pygame.image.load('down.png') ...@@ -18,8 +18,9 @@ down = pygame.image.load('down.png')
setheaing='right' setheaing='right'
head=right head=right
x,y=240,120 x,y=240,120
FPSCLOCK=pygame.time.Clock() FPSCLOCK=pygame.time.Clock()
posion=[(240,120),(210,120),(180,120),(180,90),(x,y)] posion=[(180,90),(180,120),(210,120),(x,y)]
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:
...@@ -29,24 +30,27 @@ while True: ...@@ -29,24 +30,27 @@ while True:
if event.key == locals.K_DOWN and setheaing != 'up' : if event.key == locals.K_DOWN and setheaing != 'up' :
setheaing = 'down' setheaing = 'down'
head=down head=down
elif event.key == locals.K_UP and setheaing != 'down' :
if event.key == locals.K_UP and setheaing != 'down' :
setheaing = 'up' setheaing = 'up'
head = up head = up
elif event.key == locals.K_RIGHT and setheaing != 'left' :
if event.key == locals.K_RIGHT and setheaing != 'left' :
setheaing='right' setheaing='right'
head = right head = right
else :
if event.key == locals.K_LEFT and setheaing != 'right' :
setheaing = 'left' setheaing = 'left'
head = left head = left
# 将背景图画上去 # 将背景图画上去
if setheaing=='up': if setheaing == 'up' :
y-=30 y-=30
if setheaing=='down': if setheaing == 'down':
y+=30 y+=30
if setheaing=='right': if setheaing == 'right':
x+=30 x+=30
if setheaing=='left': if setheaing=='left':
x-=30 x-=30
posion.append((x,y)) posion.append((x,y))
posion.pop(0) posion.pop(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