Commit e093889a by BellCodeEditor

save project

parent 47a2e497
Showing with 11 additions and 2 deletions
......@@ -2,6 +2,8 @@ import pygame
import random
from pygame import locals
pygame.init()
backgroung = pygame.image.load("bg.png")
apple = pygame.image.load("apple.png")
......@@ -11,7 +13,9 @@ up = pygame.image.load("up.png")
down = pygame.image.load("down.png")
body = pygame.image.load("body.png")
score = 0
myfont = pygame.font.Font("neuropol.ttf",15)
# 创建一个窗口
pingmu = pygame.display.set_mode((660,480))
......@@ -58,12 +62,17 @@ while True:
if apple_x == x and apple_y == y:
apple_x = random.randint(0,21)*30
apple_y = random.randint(0,15)*30
score+=1
else:
postion.pop(0)
for i in range(len(postion)-1):
pingmu.blit(body,(postion[i]))
text = "Score"+str(score)
info = myfont.render(text,True,(0,0,0))
pingmu.blit(info,(550,10))
pygame.display.update()
fps.tick(15)
\ No newline at end of file
fps.tick(10)
\ 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