Commit 8829e671 by BellCodeEditor

save project

parent 15f394d3
Showing with 7 additions and 18 deletions
......@@ -2,8 +2,6 @@ import pygame
from pygame import locals
import random
blocklist=pygame.sprite.Group()
time=0
class Block(pygame.sprite.Sprite):
def __init__(self,image1,image2,image3):
super().__init__()
......@@ -76,23 +74,13 @@ while True:
screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
# if aa.rect.x <= 0-aa.rect.width: # 障碍物消失
# # 创建障碍物对象
# aa=Block(bush,cacti,stone)
# aa.rect.x -= 8
time+=1
if time>60:
time=0
if aa.rect.x <= 0-aa.rect.width: # 障碍物消失
# 创建障碍物对象
aa=Block(bush,cacti,stone)
blocklist.add(aa)
for sprite in blocklist:
sprite.rect.x-=8
screen.blit(sprite.image, (sprite.rect.x, sprite.rect.y))
if sprite.rect.x < 0:
sprite.kill()
#print(len(blocklist))
aa.rect.x -= 8
screen.blit(aa.image, (aa.rect.x, aa.rect.y))
# 刷新画面
pygame.display.update()
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