Commit ed98506d by BellCodeEditor

save project

parent b655e3a3
Showing with 8 additions and 15 deletions
......@@ -15,31 +15,24 @@ hero = [pygame.image.load("hero1.png"),pygame.image.load("hero2.png"),pygame.ima
index = 0
junpingstate = "running"
pygame.display.set_caption("悟空酷跑")
y = 400
t = 30
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type == locals.KEYDOWN:
if junpingstate == "running":
if event.type == locals.K_SPACE:
junpingstate = "up"
if event.type == K.SPACE:
junpingstate = "up"
if junpingstate == "up":
if t > 0:
y -= t
t -= 2
if y > 150:
y -= 5
else:
junpingstate = "down"
if junpingstate == "down":
if t <= 300:
y += t
t += 2
if y < 400:
y += 5
else:
junpingstate = "running"
t = 30
abc = hero[index]
index += 1
if index >= 5:
......@@ -50,4 +43,4 @@ while True:
screen.blit(abc, (150, y))
# 刷新画面
pygame.display.update()
FPS.tick(10)
\ No newline at end of file
FPS.tick(60)
\ 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