Commit a68bd5bb by BellCodeEditor

save project

parent cdb43ccc
Showing with 5 additions and 3 deletions
import pygame
from pygame import locals
s="1234"
# 初始化pygame,为使用硬件做准备
pygame.init()
......@@ -21,8 +21,8 @@ apple_x, apple_y =180,360
position = [(180, 90), (180, 120), (210, 120), (x, y)]
apple_xe=360
apple_ye=240
text=pygame.font.Font("neuropol.ttf",20)
aa=text.render(s,True,(0,0,0))
setheading = "right"
snake_head = right
......@@ -58,6 +58,7 @@ while True:
if x==apple_x and y==apple_y:
apple_x=randint(0,22)*30-30
apple_y=randint(0,16)*30-30
screen+=10
else:
position.pop(0)
position.append((x, y))
......@@ -67,6 +68,7 @@ while True:
# 将贪吃蛇的头画上去
screen.blit(snake_head, position[-1])
# 将贪吃蛇的身体画上去
screen.blit(aa,(480,0))
for i in range(len(position)-1):
screen.blit(body, position[i])
......
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