Commit e018c769 by BellCodeEditor

save project

parent 85b46a71
Showing with 10 additions and 0 deletions
...@@ -27,6 +27,7 @@ rect = obstacle.get_rect() ...@@ -27,6 +27,7 @@ rect = obstacle.get_rect()
rect.x = 1000 rect.x = 1000
rect.y = 500 - rect.height rect.y = 500 - rect.height
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -50,6 +51,7 @@ while True: ...@@ -50,6 +51,7 @@ while True:
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
wukong = hero[index] wukong = hero[index]
if jumpState == "runing": if jumpState == "runing":
index += 1 index += 1
...@@ -60,6 +62,14 @@ while True: ...@@ -60,6 +62,14 @@ while True:
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) screen.blit(road, (0, 500))
screen.blit(wukong, (150, y)) screen.blit(wukong, (150, y))
if rect.x < 0_rect.width:
obstacle = random.choice([bush,stone,cacti])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
rect.x -= 8
screen.blit(obstacle,dest:(rect.x,rect.y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(30) FPS.tick(30)
......
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