Commit 6c1399b0 by BellCodeEditor

save project

parent 420e9ceb
Showing with 1 additions and 2 deletions
...@@ -5,10 +5,8 @@ import random ...@@ -5,10 +5,8 @@ import random
pygame.init() # 初始化 pygame.init() # 初始化
class Block(pygame.sprite.Sprite): # 障碍物精灵类 class Block(pygame.sprite.Sprite): # 障碍物精灵类
def __init__(self,image1,image2,image3):
super().__init__() super().__init__()
# 加载障碍物的图片 # 加载障碍物的图片
self.image = random.choice([image1, image2, image3])
# 根据障碍物位图的宽高设置矩形 # 根据障碍物位图的宽高设置矩形
self.rect = self.image.get_rect() self.rect = self.image.get_rect()
# 障碍物绘制坐标 # 障碍物绘制坐标
...@@ -76,6 +74,7 @@ while True: ...@@ -76,6 +74,7 @@ while True:
if jumpState == "up": # 起跳状态 if jumpState == "up": # 起跳状态
if t > 0: if t > 0:
y -= t y -= t
wukong.rect.y = y wukong.rect.y = y
t -= 2 t -= 2
else: else:
......
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