Commit bb594f3f by BellCodeEditor

save project

parent 05e88b1d
Showing with 18 additions and 2 deletions
...@@ -5,14 +5,26 @@ pygame.init() ...@@ -5,14 +5,26 @@ pygame.init()
x,y = (240,120) x,y = (240,120)
clock = pygame.time.Clock() clock = pygame.time.Clock()
q = right
while True: while True:
x += 30
for a in pygame.event.get(): for a in pygame.event.get():
if a.type == locals.QUIT: if a.type == locals.QUIT:
exit() exit()
if a.type == locals.K-UP and q != done
y -= 30
q = up
if a.type == locals.K-DONE and q != up
y += 30
q = done
if a.type == locals.K-RIGHT and q != left
x += 30
q = right
if a.type == locals.K-LEFT and q != right
x -= 30
q = left
clock.tick(3) clock.tick(3)
...@@ -20,15 +32,19 @@ while True: ...@@ -20,15 +32,19 @@ while True:
h=pygame.display.set_mode((660,480)) h=pygame.display.set_mode((660,480))
bg=pygame.image.load('bg.png') bg=pygame.image.load('bg.png')
right=pygame.image.load('right.png') right=pygame.image.load('right.png')
left=pygame.image.load('left.png')
up=pygame.image.load('up.png')
done=pygame.image.load('done.png')
apple=pygame.image.load('apple.png') apple=pygame.image.load('apple.png')
body=pygame.image.load('body.png') body=pygame.image.load('body.png')
h=[(210,120),(180,120),(180,90),(x,y)] h=[(210,120),(180,120),(180,90),(x,y)]
h.blit(bg,(0,0)) h.blit(bg,(0,0))
h.append((x,y)) h.append((x,y))
h.pop(-1) h.pop(-1)
for i in range(len(h)-1): for i in range(len(h)-1):
h.blit(right,h[0]) h.blit(q,h[0])
h.blit(body,h[1]) h.blit(body,h[1])
h.blit(body,h[2]) h.blit(body,h[2])
h.blit(body,h[3]) h.blit(body,h[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