Commit 4a7e1a11 by BellCodeEditor

auto save

parent 15dca0c4
Showing with 5 additions and 6 deletions
...@@ -2,8 +2,7 @@ import pygame ...@@ -2,8 +2,7 @@ import pygame
from pygame import locals from pygame import locals
import random import random
# 初始化pygame,为使用硬件做准备 pygame.init() # 初始化pygame,为使用硬件做准备
pygame.init()
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((660, 480)) screen = pygame.display.set_mode((660, 480))
...@@ -47,7 +46,7 @@ while True: ...@@ -47,7 +46,7 @@ while True:
# 设置贪吃蛇的头部坐标 # 设置贪吃蛇的头部坐标
if setheading == "right": if setheading == "right":
x += 30 x += 30
elif setheading == "left": elif setheading == "left":
x -= 30 x -= 30
elif setheading == "up": elif setheading == "up":
...@@ -74,11 +73,11 @@ while True: ...@@ -74,11 +73,11 @@ while True:
screen.blit(body, position[i]) screen.blit(body, position[i])
info='SB:'+str(score) info='SB:'+str(score)
test=my_font.render(info,True,(12,43,24)) test=my_font.render(info,True,(120,7 ,204))
screen.blit(test,(540,10)) screen.blit(test,(540,10))
# 将果实画上去 # 将果实画上去
screen.blit(food, (apple_x,apple_y)) screen.blit(food, (apple_x,apple_y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.tick(5)
\ No newline at end of file \ 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