Commit ed336aaf by BellCodeEditor

save project

parent d83c3988
Showing with 11 additions and 8 deletions
...@@ -2,14 +2,15 @@ import pygame ...@@ -2,14 +2,15 @@ import pygame
from pygame import locals from pygame import locals
pygame.init() pygame.init()
time=pygame.time.Clock() time=pygame.time.Clock()
x=240
y=120
screen=pygame.display.set_mode((660,480)) screen=pygame.display.set_mode((660,480))
shenti=[(180,90),(180,120),(210,120),(x,y)]
bg = pygame.image.load('bg.png') bg = pygame.image.load('bg.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')
right = pygame.image.load('right.png') right = pygame.image.load('right.png')
x=240
y=120
...@@ -17,13 +18,15 @@ while True: ...@@ -17,13 +18,15 @@ 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()
x+=30 x+=30
shenti.append((x,y))
shenti.pop(0)
screen.blit(bg,(0,0)) screen.blit(bg,(0,0))
screen.blit(food,(360,300))
screen.blit(right,(x,y)) screen.blit(right,(x,y))
screen.blit(body,(210,120)) for i in range(len(shenti)-1):
screen.blit(body,(180,120)) screen.blit(body,shenti[i])
screen.blit(body,(180,90)) screen.blit(food,(360,300))
pygame.display.update() pygame.display.update()
time.tick(3) time.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