Commit a4ec4a33 by BellCodeEditor

save project

parent 8265d0b0
Showing with 4 additions and 6 deletions
...@@ -22,12 +22,12 @@ x, y = 240, 120 ...@@ -22,12 +22,12 @@ x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)] position = [(180, 90), (180, 120), (210, 120), (x, y)]
apple_Xlst=[] apple_Xlst=[]
apple_Ylst=[] apple_Ylst=[]
apple_X=360
apple_Y=240
for i in range(0,661,30): for i in range(0,661,30):
apple_Xlst.append(i) apple_Xlst.append(i)
for j in range(0,481,30): for j in range(0,481,30):
apple_Ylst.append(j) apple_Ylst.append(j)
apple_X=choice(apple_Xlst)
apple_Y=choice(apple_Ylst)
setheading = "right" setheading = "right"
snake_head = right snake_head = right
...@@ -69,14 +69,13 @@ while True: ...@@ -69,14 +69,13 @@ while True:
position.pop(0) position.pop(0)
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 将果实画上去
screen.blit(food, (apple_X,apple_Y))
# 将贪吃蛇的头画上去 # 将贪吃蛇的头画上去
screen.blit(snake_head, position[-1]) screen.blit(snake_head, position[-1])
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
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, (apple_X,apple_Y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.tick(3)
\ No newline at end of file
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