Commit 5e708611 by BellCodeEditor

save project

parent 1fcdd688
Showing with 6 additions and 1 deletions
......@@ -37,6 +37,8 @@ background_x = 0
gamestate = True
score = 0
sprite = 1
speed = 8
old_score = 0
class Player(pygame.sprite.Sprite):
def __init__(self,image):
......@@ -56,6 +58,7 @@ while True:
if event.key == locals.K_SPACE:
jumpState = "up"
speed = 8 + speed//3
# 悟空造型
wukong = Player(hero[index])
if jumpState == "runing": # 跑步状态下
......@@ -97,7 +100,7 @@ while True:
obstacle = Block(bush,stone,cacti)
block_list.add(obstacle)
for sprite in block_list:
sprite.rect.x -=8
sprite.rect.x -= speed
screen.blit(sprite.image,(sprite.rect.x,sprite.rect.y))
if sprite.rect.x <= 0-obstacle.rect.width:
sprite.kill()
......@@ -108,6 +111,8 @@ while True:
score += sprite(score)
sprite = 0
if
# 创建障碍物对象
Group(obstacle = Block(bush,stone,cacti))
obstacle.rect.x -= 8
......
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