Commit d3ad8ed7 by BellCodeEditor

save project

parent 9bb0b3ff
Showing with 12 additions and 5 deletions
......@@ -2,19 +2,26 @@ import pygame
from pygame import locals
pygame.init()#初始化pygame
screen = pygame.display.set_mode((660,480))#创建窗口
FPSCLOCK = pygame.time.Clock()
#导入图片
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
apple = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
x = 210
y = 120
while True:#永久存在
for event in pygame.event.get():#遍历pygame中的事件
if event.type == locals.QUIT:#如果是退出事件,QUIT其实是一个常量,ctcl+鼠标点locals可以查看
exit()#退出
exit()#退出
x += 30
#渲染图片,后为坐标,左上角为0,0,一小格左上角坐标为30的倍数
screen.blit(background,(0,0))
screen.blit(right,(210,120))
screen.blit(right,(x,y))
screen.blit(apple,(30,30))
screen.blit(body,(180,120))
screen.blit(body,(150,120))
screen.blit(body,(150,80))
pygame.display.update()
\ No newline at end of file
screen.blit(body,(150,90))
#刷新窗口
pygame.display.update()
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