Commit 0c6072c2 by BellCodeEditor

save project

parent 1f9466a8
Showing with 10 additions and 2 deletions
...@@ -11,6 +11,14 @@ class Block(pygame.sprite.Sprite): ...@@ -11,6 +11,14 @@ class Block(pygame.sprite.Sprite):
self.rect.y=500-self.rect.height self.rect.y=500-self.rect.height
pygame.init() # 初始化 pygame.init() # 初始化
# 创建一个窗口 # 创建一个窗口
class Player(pygame.sprite.Sprite):
def __init__(self,image):
super().__init__()
self.image = image
self.rect = self.image.get_rect()
self.rect.x = 150
self.rect.y = 400
screen = pygame.display.set_mode((1000, 600)) screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
pygame.display.set_caption("悟空酷跑") pygame.display.set_caption("悟空酷跑")
...@@ -59,7 +67,7 @@ while True: ...@@ -59,7 +67,7 @@ while True:
t =30 t =30
# 悟空造型 # 悟空造型
wukong = hero[index] wukong = Player(hero[index])
if jumpState == "runing": # 跑步状态下 if jumpState == "runing": # 跑步状态下
index += 1 index += 1
if index >= 5: if index >= 5:
...@@ -73,7 +81,7 @@ while True: ...@@ -73,7 +81,7 @@ while True:
if lu_x <-1000: if lu_x <-1000:
lu_x=0 lu_x=0
screen.blit(road, (lu_x, 500)) # 路 screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong.image, (150, y)) # 悟空
time += 1 time += 1
if time >=60: if time >=60:
......
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