Commit 85562083 by BellCodeEditor

save project

parent 16d35c29
Showing with 23 additions and 28 deletions
......@@ -17,47 +17,42 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
y=400
y=400
index = 0
z='r'
t=30
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE:
z='u'
if event.type == locals.KEYDOWN:
if z=='r':
if event.key == locals.K_SPACE:
z='u'
if z=='u':
if y>150:
y-=0.01
else:
z='d'
if z=='d':
if y<400:
y+=0.01
else:
z='r'
wukong=hero[index]
index+=1
if index == 5:
index=1
if z=='u'or z=='d':
index=1
if z == 'u':
if t>0:
y-=t
t-=2
else:
z='d'
if z=='d':
if t<=30:
y+=t
t+=2
else:
z='d'
t=30
# 将背景图画上去
screen.blit(background, (0, 0))
......@@ -65,4 +60,4 @@ while True:
screen.blit(wukong, (150, y))
# 刷新画面
pygame.display.update()
FPS.tick(200000000000000000000000)
\ No newline at end of file
FPS.tick(99)
\ 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