Commit 9fef5d5d by BellCodeEditor

save project

parent 9133a0d2
Showing with 8 additions and 0 deletions
......@@ -6,6 +6,7 @@ pygame.init()
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
# 创建一个窗口
screen = pygame.display.set_mode((660,480))
......@@ -13,6 +14,13 @@ while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
elif event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT and setheading !="left":
setheading == 'right'
snack_head = right
if event.key == locals.K_LEFT and setheading !="right":
screen. blit(background,(0,0))
screen. blit(right,(290,120))
screen. blit(food,(300,300))
......
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