Commit 91060f92 by BellCodeEditor

save project

parent 16af5301
Showing with 4 additions and 4 deletions
...@@ -25,16 +25,16 @@ while True: ...@@ -25,16 +25,16 @@ while True:
if event.key ==locals.K_LEFT and setheading !="right": if event.key ==locals.K_LEFT and setheading !="right":
setheading = 'left' setheading = 'left'
snake_head = 'left' snake_head = 'left'
if event.key == locals.K_UP and,setheading != "down" if event.key == locals.K_UP and setheading != "down":
setheading ='up' setheading ='up'
snake_head = up snake_head = up
if event.key == locals.K_DOWN and setheading !="up" if event.key == locals.K_DOWN and setheading !="up":
setheading = 'down' setheading = 'down'
snake_head =down snake_head =down
if setheading == "right": if setheading == "right":
x += 30 x += 30
elif setheading == "left": elif setheading == "left":
x-= x-= 30
elif setheading == "up": elif setheading == "up":
y-= 30 y-= 30
else: else:
...@@ -45,7 +45,7 @@ while True: ...@@ -45,7 +45,7 @@ while True:
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(right, position[-1]) screen.blit(right, position[-1])
screen.blit(right, (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