Commit 5071298d by BellCodeEditor

save project

parent 79c04a49
Showing with 13 additions and 4 deletions
......@@ -9,7 +9,15 @@ class Block(pygame.sprite.Sprite):
self.rect=self.image.get_rect()
self.rect.x=1000
self.rect.y=500-self.rect.height
class
class Wukong(pygame.sprite.Sprite):
def __init__(self,wk_image):
super().__init__()
self.=wk_image
self.rect=self.image[0].get_rect()
self.rect.x=150
self.rect.y=400
pygame.init() # 初始化
# 创建一个窗口
......@@ -42,6 +50,8 @@ obs.rect.y = 500 - obs.rect.height
block_list=pygame.sprite.Group()
block_list.add(obs)
time=0
wuk=Wukong(hero)
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -67,7 +77,7 @@ while True:
t =30
# 悟空造型
wukong = hero[index]
if jumpState == "runing": # 跑步状态下
index += 1
if index >= 5:
......@@ -83,7 +93,7 @@ while True:
road_x=0
screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
screen.blit(wuk.image[index], (150, y)) # 悟空
time+=1
if time>=60:
time=0
......@@ -94,7 +104,6 @@ while True:
for i in block_list:
i.rect.x-=8
screen.blit(i.image, (i.rect.x, i.rect.y))
if pygame.sprite.col
if i.rect.x<0-i.rect.width:
i.kill()
# 刷新画面
......
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