Commit 023c816b by BellCodeEditor

save project

parent 19aad79e
Showing with 10 additions and 1 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random
...@@ -12,6 +12,9 @@ x,y=240,120 ...@@ -12,6 +12,9 @@ x,y=240,120
# 创建一个窗口 # 创建一个窗口
position=[(180,90),(180,120),(210,120),(x,y)] position=[(180,90),(180,120),(210,120),(x,y)]
apple_x = 360
apple_y = 300
screen = pygame.display.set_mode((660, 480)) screen = pygame.display.set_mode((660, 480))
FPS=pygame.time.Clock() FPS=pygame.time.Clock()
# 背景 # 背景
...@@ -55,6 +58,12 @@ while True: ...@@ -55,6 +58,12 @@ while True:
else : else :
y+=30 y+=30
if x == apple_x and y==apple_y:
apple_x=random.randint(0,660)
apple_y=random.randint(0,480)
position.append((x,y)) position.append((x,y))
position.pop(0) position.pop(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