Commit 9053dd7c by BellCodeEditor

save project

parent 446a7fa3
Showing with 26 additions and 15 deletions
......@@ -7,30 +7,41 @@ apple=pygame.image.load("apple.png")
right=pygame.image.load("right.png")
body=pygame.image.load("body.png")
x,y=240,120
setheading="r"
position=[(180,90),(180,120),(210,120),(x,y)]
FPSCLOCK=pygame.time.Clock()
while True:
for event in pygame.event.get():
print(event.type)
print(event)
if event.type== locals.QUIT:
exit()
screen.blit(bg,(0,0))
screen.blit(apple,(550,550))
screen.blit(right,(x,y))
x+=1.3
y+=1.3
screen.blit(body,(x-30,y))
screen.blit(body,(x-60,y))
screen.blit(body,(x-90,y))
screen.blit(body,(x-120,y))
pygame.display.update()
FPSCLOCK.tick(60)
screen.blit(apple,(550,550))
if event.type==locals.KEYDOWN:
if event.key==locals.K_DOWN:
setheading="d"
if event.key==locals.K_UP:
setheading="u"
screen.blit(right,(x,y))
for i in range(len(position)-2,-1,-1):
screen.blit(body,position[i])
if setheading=="d":
y+=30
if setheading=="r":
x+=30
position.append((x,y))
position.pop(0)
pygame.display.update()
FPSCLOCK.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