Commit 5c8c68fe by BellCodeEditor

auto save

parent 18d0be31
Showing with 9 additions and 38 deletions
......@@ -20,50 +20,20 @@ index = 0
y = 400
t = 30
jumpState = "running"
obstacle = random.choice([bush,stone,cacti])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
if jumpState == "running":
if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE:
jumpState = "up"
if jumpState == "up":
if t > 0:
y -= t
t -= 2
else:
jumpState = "down"
if jumpState == "down":
if t <= 30:
y += t
t += 2
else:
jumpState = "running"
t = 30
if jumpState == "running":
index += 1
if index>4:
index = 0
wukong = hero[index]
index=index+1
if index>4:
index=0
w=hero[index]
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
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,(rect.x,rect.y))
screen.blit(w, (150, y))
pygame.display.update()
FPS.tick(60)
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