Commit 81c8d82a by BellCodeEditor

save project

parent d27b41ba
Showing with 12 additions and 9 deletions
......@@ -32,13 +32,21 @@ y = 400
jumpState = "runing"
t = 30
sb=B(bush,cacti,stone)
sp=pygame.sprite.Group()
sp_list=pygame.sprite.Group()
time=0
while True:
if time=60:
time+=1
if time==60:
time=0
num=random.randint(0,50)
screen.blit(sb.image, (sb.rect.x, sb.rect.y))
num=random.randint(0,100)
if num>40:
sb=B(bush,cacti,stone)
sp_list.add(sb)
for vk in sp_list:
vk.rect.x-=8
screen.blit(vk.image, (vk.rect.x, vk.rect.y))
if vk.rect.x<=0-vk.rect.width:
vk.kill()
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
......@@ -79,11 +87,6 @@ while True:
screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
if sb.rect.x <= 0-sb .rect.width: # 障碍物消失
# 创建障碍物对象
aa=B(bush,cacti,stone)
sb.rect.x -= 8
# 刷新画面
......
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