Commit 469d192e by BellCodeEditor

auto save

parent 25396203
Showing with 4 additions and 12 deletions
...@@ -7,11 +7,6 @@ pygame.init() ...@@ -7,11 +7,6 @@ pygame.init()
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((660, 480)) screen = pygame.display.set_mode((660, 480))
# 背景
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
x,y=240,120 x,y=240,120
FPSCLOCK=pygame.time.Clock() FPSCLOCK=pygame.time.Clock()
while True: while True:
...@@ -25,11 +20,9 @@ while True: ...@@ -25,11 +20,9 @@ while True:
x+=30 x+=30
screen.blit(right, (x, y)) screen.blit(right, (x, y))
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
screen.blit(body, (210, 120)) pygame.draw.rect(screen,(255,0,0),(center[1]*20-20,center[0]*20-20,20,20),0)
screen.blit(body, (180, 120)) pygame.draw.rect(screen,(255,255,255),(center[1]*20-20,center[0]*20-20,20,20),1)
screen.blit(body, (180, 90))
# 将果实画上去
screen.blit(food, (360, 300))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.tick(3)
\ 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