Commit 26261c3d by BellCodeEditor

save project

parent cc46e677
Showing with 19 additions and 1 deletions
...@@ -12,6 +12,9 @@ background = pygame.image.load('bg.png') ...@@ -12,6 +12,9 @@ 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') body = pygame.image.load('body.png')
left = pygame.image.load("left.ping")
up = pygame.image.load("up.ping")
down = pygame.image.load("down.ping")
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -31,12 +34,27 @@ while True: ...@@ -31,12 +34,27 @@ while True:
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
Time=pygame.time.Clock() Time=pygame.time.Clock()
= [240,120]
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:
exit() exit()
if event.type == locals.KEYDOWN
if setheading =="right":
x += 30
snake_head = right
elif setheading == "left":
x -= 30
snake_head = left
elif setheading == "up":
y -= 30
snake_head = up
else:
y += 30
snake_head = down
screen.blit(background,(0,0)) screen.blit(background,(0,0))
......
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