Commit cf88de8e by BellCodeEditor

save project

parent 08afd35a
Showing with 26 additions and 14 deletions
......@@ -11,6 +11,15 @@ class Block(pygame.sprite.Sprite)
self.rect.x = 1000
self.rect.y = 500 - rect.height
screen = pygame.display.set_mode((1000, 600))
class Player(pygame.sprite.Sprite)
daf_init_(self,image)
super()_init_()
self.image= image
self.rect =selfimage.get_rect()
self.rect.x = 1000
self.rect.y = 500 - rect.height
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
pygame.display.set_caption("悟空酷跑")
# 载入图片
......@@ -31,6 +40,7 @@ t = 30
road_x=0
bg_x=0
time = 0
gamestart = True
# obstacle = Block(bush, stone, cacti)
Block_list = pygame.sprite.Group()
......@@ -43,20 +53,22 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
wukong = Plo
if gamestart == True
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
t -= 2
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 30:
y += t
t += 2
else:
jumpState = "runing"
t =30
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
t -= 2
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 30:
y -= t
wukong.rect.y = y
else:
jumpState = "runing"
t =30
# 悟空造型
wukong = hero[index]
......@@ -82,7 +94,7 @@ while True:
obstacle = Block(bush, stone, cacti)
block_list.add(obstacle)
time = 0
screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.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