Commit 6eeb8117 by BellCodeEditor

save project

parent 02ac6ca3
Showing with 5 additions and 6 deletions
......@@ -10,23 +10,21 @@ screen = pygame.display.set_mode((660, 480))
# 背景
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
bomb = pygame.image.load('bomb.png')
body = pygame.image.load('body.png')
up = pygame.image.load('up.png')
right = pygame.image.load('right.png')
left = pygame.image.load('left.png')
down = pygame.image.load('down.png')
x=210
y=120
liebiao=[(180,90),(180,120),(210,120),(x,y)]
setheading='right'
snake_hade=right
liebiao=[(180,90),(180,120),(210,120),(x,y)]
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type == locals.KEYDOWN:
elif event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT and setheading != 'left':
setheading = 'right'
snake_hade=right
......@@ -60,13 +58,13 @@ while True:
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
screen.blit(right, (x, y))
screen.blit(snake_hade,liebiao[-1])
# 将贪吃蛇的身体画上去
screen.blit(body, liebiao[-2])
screen.blit(body, liebiao[-3])
screen.blit(body, liebiao[-4])
# 将果实画上去
screen.blit(bomb, (360, 300))
# 刷新画面
pygame.display.update()
zhen.tick(5)
\ 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