Commit 6f34be29 by BellCodeEditor

save project

parent 8873374b
Showing with 7 additions and 2 deletions
...@@ -21,6 +21,7 @@ pygame.display.set_caption(" ...@@ -21,6 +21,7 @@ pygame.display.set_caption("
jumpS = "run" jumpS = "run"
y = 400 y = 400
yy = 30 yy = 30
roadx = 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -31,6 +32,7 @@ while True: ...@@ -31,6 +32,7 @@ while True:
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
if jumpS == "run": if jumpS == "run":
jumpS = "up" jumpS = "up"
print(roadx)
if jumpS == "up": if jumpS == "up":
if yy > 0: if yy > 0:
y-=yy y-=yy
...@@ -46,11 +48,13 @@ while True: ...@@ -46,11 +48,13 @@ while True:
yy = 30 yy = 30
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) screen.blit(road, (roadx, 500))
screen.blit(hero[index], (150, y)) screen.blit(hero[index], (150, y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(40) FPS.tick(40)
if jumpS == "run": if jumpS == "run":
index=(index+1)%5 index=(index+1)%5
roadx -= 5
if roadx == -1000:
roadx = 0
\ 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