Commit 56442dc5 by BellCodeEditor

save project

parent 44c75cb2
Showing with 8 additions and 2 deletions
......@@ -7,8 +7,8 @@ pygame.init() # 初始化
class Block(pygame.sprite.Sprite):
def __init__(self,image1,image2,image3):
super().__init__()
self.image=random.choice([image1,image2,image3])
self.rect=self.image.get_rect()
self.image=random.choice([bush, stone, cacti])
self.rect.x=1000
self.rect.y=500-self.rect.height
......@@ -32,7 +32,9 @@ index = 0
y = 400
jumpState = "runing"
t = 30
road_x=0
obstacle = Block(stone,cacti,bush)
ground_x=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -67,8 +69,12 @@ while True:
if road_x<-1000:
road_x=0
ground_x-=4
if ground_x<-1000:
ground_x=0
# 将背景图画上去
screen.blit(background, (0, 0)) # 远处背景
screen.blit(background, (ground_x, 0)) # 远处背景
screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
......
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