Commit b8db9b9d by BellCodeEditor

save project

parent 9228b980
Showing with 7 additions and 5 deletions
......@@ -13,18 +13,20 @@ right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
x, y = 240, 120
setheading = 'right'
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.key == locals.K_RIGHT and setheading != "left"
setheading = 'right
if event.key == locals.K_RIGHT and setheading != "right"
if event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT and setheading != "left":
setheading = 'right'
if event.key == locals.K_RIGHT and setheading != "right":
setheading = 'left'
if event.key == locals.K_RIGHT and setheading != "down"
if event.key == locals.K_RIGHT and setheading != "down":
setheading = 'up'
if event.key == locals.K_RIGHT and setheading != "up"
if event.key == locals.K_RIGHT and setheading != "up":
setheading = 'down'
if setheading == "right":
......
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