Commit 8e6026f0 by BellCodeEditor

save project

parent 4ef80165
Showing with 9 additions and 1 deletions
import random
ap1=360
ap2=300
import pygame import pygame
from pygame import locals from pygame import locals
...@@ -47,6 +50,9 @@ while True: ...@@ -47,6 +50,9 @@ while True:
y-=30 y-=30
else: else:
y+=30 y+=30
if x==ap1 and y==ap2:
ap1=random.(randint(0,21))30
ap2=random.(randint(0,15))*30
snake.append((x,y)) snake.append((x,y))
snake.pop(0) snake.pop(0)
# 将背景图画上去 # 将背景图画上去
...@@ -58,9 +64,10 @@ while True: ...@@ -58,9 +64,10 @@ while True:
screen.blit(body, snake[i]) screen.blit(body, snake[i])
# 将果实画上去 # 将果实画上去
screen.blit(food, (360, 300)) screen.blit(food, (ap1, ap2))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(5) FPS.tick(5)
\ 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