Commit 542143ff by BellCodeEditor

auto save

parent dc6533ad
Showing with 11 additions and 2 deletions
'''
#贪吃蛇是否撞墙
if x < 0 or x > 630 or y < 0 or y > 450: #如果蛇超出四个边界其中之一
exit() #退出
#不碰身子
for i in range(len(snake)-1):
if snake[i] == snake[len(snake)-1]:
print("wuoa!")
'''
\ No newline at end of file
......@@ -89,10 +89,10 @@ while True:#重复执行以下代码
#通过减1来遍历列表中从第1项到倒数第2项所有坐标
#绘制分数
info = 'Score' + ' ' + str(score) #将要打印的内容
info = 'Score' + ' ' + str(score) #将将要打印的内容赋值给变量
text = my_font.render(info,True,(0,0,0)) #以纯黑色渲染,赋值给变量
screen.blit(text,(540,10)) #在540,10渲染分数
#(0,0,0)是色盘,由三个0-255的数表示颜色,(0,0,0)指黑色
#(0,0,0)是色盘数据,由三个0-255的数表示颜色,(0,0,0)指黑色
pygame.display.update()#刷新屏幕,保证看到最新画面
FPSCLOCK.tick(3) #设置帧数(设置运行速度)
\ 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