Commit 98b0949b by BellCodeEditor

auto save

parent 0816d79e
Showing with 12 additions and 12 deletions
...@@ -7,26 +7,27 @@ pygame.init() ...@@ -7,26 +7,27 @@ pygame.init()
pyame.display.set-mode((800,600))import pygame pyame.display.set-mode((800,600))import pygame
from pygame import locals from pygame import locals
FPSCLOCK=pygame.time.Clock()
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
bg=pygame.image.load("bg.png") x,y=240,120
right=pygame.image.load("right.png") position=[(180,90),(180,120),(210,120),(x,y)]
app=pygame.image.load("apple.png")
bd=pygame.image.load("body.png")
# 创建一个窗口 # 创建一个窗口
pygame.display.set_mode((800,600)) pygame.display.set_mode((800,600))
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type==locals.QUIT: if event.type==locals.QUIT:
exit() exit()
x+=30
position.append((x,y))
position.pop(0)
screen.blit(bg,(0,0)) screen.blit(bg,(0,0))
screen.blit(right,(240,120)) screen.blit(right,position[-1])
screen.blit(body,(210,120)) for i in range(len(position)-1):
screen.blit(body,(180,120)) screen.blit(bd,
screen.blit(body,(150,120))
screen.blit(food,(360,300)) screen.blit(app,(360,300))
pygame.display.update() pygame.display.update()
\ 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