Commit 9796a097 by BellCodeEditor

auto save

parent afae93d0
Showing with 7 additions and 3 deletions
import pygame import pygame
from pygame import locals from pygame import locals
random import import random
pygame.init() pygame.init()
...@@ -16,6 +16,7 @@ body = pygame.image.load('body.png') ...@@ -16,6 +16,7 @@ body = pygame.image.load('body.png')
left = pygame.image.load('left.png') left = pygame.image.load('left.png')
up = pygame.image.load('up.png') up = pygame.image.load('up.png')
down = pygame.image.load('down.png') down = pygame.image.load('down.png')
my_fort = pygame.fort.font('neurapo')
x, y = 240, 120 x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)] position = [(180, 90), (180, 120), (210, 120), (x, y)]
...@@ -56,13 +57,14 @@ while True: ...@@ -56,13 +57,14 @@ while True:
position.append((x, y)) position.append((x, y))
if x==apple_x and y==apple_y: if x==apple_x and y==apple_y:
num1=random.randint(1.22) num1=random.randint(1,22)
num2=random.randint(1,16) num2=random.randint(1,16)
apple_x=30*num1-30 apple_x=30*num1-30
apple_y=30*num2-30 apple_y=30*num2-30
else: else:
position.pop(0) position.pop(0)
if x <630 or y<450:
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
...@@ -72,7 +74,9 @@ while True: ...@@ -72,7 +74,9 @@ while True:
screen.blit(body, position[i]) screen.blit(body, position[i])
screen.blit(food, (360, 300)) screen.blit(food, (apple_x, apple_y))
info="Score:"+str(score)
text=pygame
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.tick(3)
......
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