Commit 89140d06 by BellCodeEditor

auto save

parent 29f1e1bd
Showing with 13 additions and 4 deletions
......@@ -7,6 +7,14 @@ class Block(pygame.sprite.Sprite):
super().__init__()
self.image=random.choice([image1,image2,image3])
self.rect=self.image.get_rect()
class Block(pygame.sprite.Sprite):
def __init__(self,image1,image2,image3):
super().__init__()
self.image=random.choice([image1,image2,image3])
self.rect=self.image.get_rect()
self.rect.x=150
self.rect.y=400
self.rect.x=1000
self.rect.y=500-self.rect.height
pygame.init() # 初始化
......@@ -31,6 +39,7 @@ index = 0
y = 400
jumpState = "runing"
t = 30
gamestate=True
aa=Block(bush,cacti,stone)
while True:
......@@ -42,7 +51,7 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
wukong=player(hero[index])
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
......@@ -63,7 +72,7 @@ while True:
index += 1
if index >= 5:
index = 0
# 将背景图画上去
# 将背景图画上去
shan_x -=2
if shan_x <-1000:
shan_x=0
......@@ -83,4 +92,4 @@ while True:
screen.blit(aa.image, (aa.rect.x, aa.rect.y))
# 刷新画面
pygame.display.update()
FPS.tick(70)
\ No newline at end of file
FPS.tick(60)
\ No newline at end of file
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