Commit 446902b7 by BellCodeEditor

save project

parent a7e590dc
Showing with 6 additions and 4 deletions
import pygame
import random
from pygame import locals
# 初始化pygame,为使用硬件做准备
......@@ -48,8 +49,9 @@ while True:
else:
y-=30
snake_hard = up
if positine[-1] == apple_x,apple_y:
apple_x,apple_y =
if x == apple_x and y == apple_y:
apple_x = random.randint(30,630)
apple_y = random.randint(30,450)
positine.append((x,y))
positine.pop(0)
# 将背景图画上去
......@@ -64,4 +66,4 @@ while True:
# 刷新画面
pygame.display.update()
# 设置帧数
FPSCLOCK = pygame.time.Clock();FPSCLOCK.tick(9)
\ No newline at end of file
FPSCLOCK = pygame.time.Clock();FPSCLOCK.tick(4)
\ 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