Commit f35f7741 by BellCodeEditor

auto save

parent 8b8d320b
Showing with 15 additions and 3 deletions
import random
import pygame import pygame
from pygame import locals from pygame import locals
x,y=240,120 x,y=240,120
apple_x,apple_y=360,300
#rx=240 #rx=240
#ry=120 #ry=120
#bx1=210 #bx1=210
...@@ -60,7 +62,13 @@ while True: ...@@ -60,7 +62,13 @@ while True:
# x+=30 # x+=30
z.append((x,y)) z.append((x,y))
if x == apple_x and y == apple_y:
apple_x = random.randint(0,21)*30
apple_y = random.randint(0,15)*30
else:
z.pop(0) z.pop(0)
# screen.blit(body,())
# z.pop(0)
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
...@@ -73,7 +81,11 @@ while True: ...@@ -73,7 +81,11 @@ while True:
# screen.blit(body, (180, 120)) # screen.blit(body, (180, 120))
# screen.blit(body, (180,90)) # screen.blit(body, (180,90))
# 将果实画上去 # 将果实画上去
screen.blit(food, (360, 300)) screen.blit(food, (apple_x, apple_y))
example = pygame.font.Font(filename, size)
info='分数:'+str(score)
text=example.render(info,True,(255,255,0))
screen.blit(text,(500,30))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
sj.tick(6) sj.tick(4)
\ 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