Commit a38267f5 by BellCodeEditor

save project

parent 7322e026
Showing with 19 additions and 10 deletions
...@@ -20,6 +20,7 @@ index = 0 ...@@ -20,6 +20,7 @@ index = 0
pygame.display.set_caption(" 顶级大傻的跑酷") pygame.display.set_caption(" 顶级大傻的跑酷")
jumpS = "run" jumpS = "run"
y = 400 y = 400
yy=5
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -28,18 +29,25 @@ while True: ...@@ -28,18 +29,25 @@ while True:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
if y == 400: if jumpS == "run":
jumpS = "up" jumpS = "up"
# if jumpS == "up":
# if y>150:
# y-=5
# else:
# jumpS = "down"
# if jumpS == "down":
# if y<400:
# y+=5
# else:
# jumpS = "run"
if jumpS == "up": if jumpS == "up":
if y>150: y-=1
y-=5
else:
jumpS = "down"
if jumpS == "down":
if y<400: if y<400:
y+=5 y-=yy
yy-=0.1
else: else:
jumpS = "run" jumpS = "run"
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) screen.blit(road, (0, 500))
...@@ -47,4 +55,6 @@ while True: ...@@ -47,4 +55,6 @@ while True:
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
index=(index+1)%5 if jumpS == "run":
\ No newline at end of file index=(index+1)%5
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