Commit 6297ae3a by BellCodeEditor

save project

parent 02b502cb
Showing with 7 additions and 2 deletions
...@@ -10,6 +10,7 @@ from pygame import locals ...@@ -10,6 +10,7 @@ from pygame import locals
apple_x = 360 apple_x = 360
apple_y = 300 apple_y = 300
score = 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if eyent.type == locals.QUIT: if eyent.type == locals.QUIT:
...@@ -21,10 +22,14 @@ from pygame import locals ...@@ -21,10 +22,14 @@ from pygame import locals
screen.blit(body,(180,90)) screen.blit(body,(180,90))
screen.blit(food,(360,300)) screen.blit(food,(360,300))
pygame.dispiay.update() pygame.dispiay.update()
my_font = pygame.font.Font('neuropo1.ttf', 18)
if x == apple_x and y == apple_y: if x == apple_x and y == apple_y:
apple_x = random.randint(1,22) apple_x = random.randint(1,22)
apple_y = random.randint(1,16) apple_y = random.randint(1,16)
apple_x = num1 * 30 - 30 apple_x = num1 * 30 - 30
apple_y = num2 * 30 - 30 apple_y = num2 * 30 - 30
else: else:
position.pop(0) position.pop(0)
\ No newline at end of file info = "Score"+ str(score)
text = my_font.render(info, True, (0,0, 0))
screen.blit(text, (540, 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