Commit 377e0918 by BellCodeEditor

save project

parent 9e3de719
Showing with 16 additions and 11 deletions
...@@ -4,19 +4,24 @@ from pygame import locals ...@@ -4,19 +4,24 @@ from pygame import locals
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
background = pygame.image.load('bg.png') background = pygame.image.load('bg.png')
apple = pygame.image.load('apple.png')
right = pygame.image.load('right.png')
left = pygame.image.load('left.png')
up = pygame.image.load('up.png')
down = pygame.image.load('down.png')
body = pygame.image.load('body.png')
x = 660
y = 480
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((x,y)) screen = pygame.display.set_mode((660,480))
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
print(event) print(event)
if event.type == locals.QUIT: if event.type == locals.QUIT:
x -= 20 quit()
y -= 20 screen.blit(background,(0,0))
screen = pygame.display.set_mode((x,y)) screen.blit(apple,(630,450))
screen = pygame.display.set_mode((x,y)) screen.blit(right,(30,0))
screen.blit(background,(10,10)) screen.blit(body,(0,0))
screen.display.update() screen.blit(body,(0,30))
\ No newline at end of file screen.blit(body,(0,60))
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