Commit 03da3a44 by BellCodeEditor

save project

parent 6842e7e6
Showing with 8 additions and 8 deletions
...@@ -5,17 +5,13 @@ import random ...@@ -5,17 +5,13 @@ import random
pygame.init() # 初始化 pygame.init() # 初始化
class Ws(pygame.sprite.Sprite): class Ws(pygame.sprite.Sprite):
der _init_(self,image1,image2,image3): def _init_(self,image1,image2,image3):
super()._init_() super()._init_()
self.image = random.choice([image1, image2, image3]) self.image = random.choice([image1, image2, image3])
self.rect = self.image.get_rect() 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时钟,控制游戏速度(帧数)
...@@ -87,6 +83,10 @@ while True: ...@@ -87,6 +83,10 @@ while True:
screen.blit(background, (0, 0)) # 远处背景 screen.blit(background, (0, 0)) # 远处背景
screen.blit(road, (0, 500)) # 路 screen.blit(road, (0, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
if rect.x <= 0-rect.width: # 障碍物消失 if rect.x <= 0-rect.width: # 障碍物消失
# 创建障碍物对象 # 创建障碍物对象
......
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