Commit da808905 by BellCodeEditor

auto save

parent 56fcbba4
Showing with 4 additions and 5 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random
# 初始化pygame,为使用硬件做准备 # 初始化pygame,为使用硬件做准备
pygame.init() pygame.init()
x,y=240,120 x,y=240,120
...@@ -19,6 +19,7 @@ while True: ...@@ -19,6 +19,7 @@ while True:
x+=30 x+=30
ada.append((x,y)) ada.append((x,y))
ada.pop(0) ada.pop(0)
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
...@@ -31,11 +32,9 @@ while True: ...@@ -31,11 +32,9 @@ while True:
for i in range(len(ada)-1): for i in range(len(ada)-1):
screen.blit(body,ada[i]) screen.blit(body,ada[i])
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
if x<0 or x>630 or y<0 or y>450: if x<0
exit()
# 将果实画上去
# 刷新画面
pygame.display.update() pygame.display.update()
FPSLOCK.tick(3) FPSLOCK.tick(3)
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