Commit 436db26f by BellCodeEditor

auto save

parent d8a5ad68
Showing with 4 additions and 13 deletions
......@@ -11,15 +11,7 @@ class Block(pygame.sprite.Sprite) :
self.rect = self.image.get_rect()
self.rect.x = 1000
self.rect.y = 500 - self.rect.height
class Player(pygame.sprite.Sprite) :
def __init__(self,image):
super().__init__()
self.image = image
#self.image = random.choice([image1,image2,image3])
#self.rect = self.image.get_rect()
self = self.image.get_rect()
self.rect.x = 150
self.rect.y = 400
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
......@@ -35,12 +27,11 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
score_audio= p
index = 0
y = 400
jumpState = "runing"
t = 30
gamestate = True
time = 0
#obstacle = Block([bush, stone, cacti])
block_list = pygame.sprite.Group()
......@@ -53,12 +44,12 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
wukong = player(hero[index])
wukong = hero[index]
if jumpState == "runing": # 跑步状态下
index += 1
if index >= 5:
index = 0
if gamestate == True:
if g
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
......
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