Commit 96d87d41 by BellCodeEditor

auto save

parent 3c133458
Showing with 15 additions and 2 deletions
...@@ -31,17 +31,30 @@ index = 0 ...@@ -31,17 +31,30 @@ index = 0
y = 400 y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
obstacle = random.choice([bush, stone, cacti]) obstacle_list = obstacle.gpygame.sprite.Sprite
rect = obstacle.get_rect()
rect.x = 1000 rect.x = 1000
rect.y = 500 - rect.height rect.y = 500 - rect.height
road_x=0 road_x=0
background_x=0 background_x=0
time=0
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:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
time+=1
if time>=60:
time=0
num=random.randint(0,50)
if num>20:
obstacle = jinglin(stone,cacti,bush)
obstacle_list.add(obstacle)
for temp_sprite in obstacle_list:
temp_sprite.rect.x-=8
screen.blit(temp_sprite.image,(temp_sprite.rect.x,temp_sprite.rect.y))
if temp_sprite.rect.x<=0-temp_sprite.rect.x
temp_sprite.killl()
if pygame.sprite.collide_rect
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if jumpState == "runing": if jumpState == "runing":
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
......
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