Commit 1a2919f4 by BellCodeEditor

save project

parent bea756d4
Showing with 9 additions and 2 deletions
...@@ -5,8 +5,13 @@ from random import* ...@@ -5,8 +5,13 @@ from random import*
pygame.init() # 初始化 pygame.init() # 初始化
class class Block(pygame.sprite.Sprite):
def __init__(self,image1,imeage2,image3):
super().__init__()
self.image = random.choice([image1,image2,image3])
self.rect = self.image.get_rect()
self.rect.x = 1000
self.rect.y = 500 - self.rect.height
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((1000, 600)) screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
...@@ -82,6 +87,8 @@ while True: ...@@ -82,6 +87,8 @@ while True:
xingzhuang = zhangaiwu.gut_rest()#获得障碍物的坐标和宽,高 xingzhuang = zhangaiwu.gut_rest()#获得障碍物的坐标和宽,高
xingzhuang.x = 1000#使障碍物的x为1000 xingzhuang.x = 1000#使障碍物的x为1000
xingzhuang.y = 500-xingzhuang.height#初始化障碍物的坐标 xingzhuang.y = 500-xingzhuang.height#初始化障碍物的坐标
time += 1
if time >= 60
screen.blit(zhangaiwu,(xingzhuang.x,xingzhuang.y)) screen.blit(zhangaiwu,(xingzhuang.x,xingzhuang.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