Commit f2b2a2ff by BellCodeEditor

save project

parent 602a6e58
Showing with 19 additions and 3 deletions
...@@ -4,7 +4,13 @@ pygame.init() ...@@ -4,7 +4,13 @@ pygame.init()
background = pygame.image.load('bg.png') 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')
screen = pygame.display.set_mode((660,480)) screen = pygame.display.set_mode((660,480))
FPSCLOCK = pygame.time.Clock()
...@@ -15,12 +21,21 @@ screen = pygame.display.set_mode((660,480)) ...@@ -15,12 +21,21 @@ screen = pygame.display.set_mode((660,480))
x,y=240,120
positoin = [(180,90), (180,120), (210,120), (x,y)]
setheading="right"
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
print(event) if event.type==locals.QUIT:
if event in pygame.event.get():
exit() exit()
if event.type==locals.KEYDOWN
x +=30
positoin.append((x,y))
positoin.pop(0)
screen.blit(background,(0,0)) screen.blit(background,(0,0))
screen.blit(right,(240,120)) screen.blit(right,positoin[-1])
for i in range(len(positoin)-1):
screen.blit(body, positoin[1])
screen.blit(food , (360,300)) screen.blit(food , (360,300))
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3)
\ 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