Commit bb6c31e0 by BellCodeEditor

save project

parent df942c13
Showing with 5 additions and 4 deletions
import pygame import pygame
from pygame import locals
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
...@@ -11,7 +11,8 @@ right=pygame.image.load('right.pag') ...@@ -11,7 +11,8 @@ right=pygame.image.load('right.pag')
food=pygame.image.load('apple.pag') food=pygame.image.load('apple.pag')
body=pygame.image.load('body.pag') body=pygame.image.load('body.pag')
x,y=240,120 x,y=240,120
position=[(180,90),(180,120),(210,120),(x,y)]
setheading
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type==locals.QUIT: if event.type==locals.QUIT:
...@@ -20,8 +21,8 @@ while True: ...@@ -20,8 +21,8 @@ while True:
position.append((x,y)) position.append((x,y))
position.pop(0) position.pop(0)
screen.blit(background,(0,0)) screen.blit(background,(0,0))
screen.blit(right,(240,x,y)) screen.blit(right,(x,y))
for i in range(len(position)-1) for i in range(len(position)-1):
screen.blit(body,position[i]) screen.blit(body,position[i])
screen.blit(food,(360,300)) screen.blit(food,(360,300))
pygame.display.update() pygame.display.update()
......
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