Commit 88e69c8b by BellCodeEditor

save project

parent c39a13c3
Showing with 11 additions and 4 deletions
...@@ -14,6 +14,9 @@ cacti = pygame.image.load('cacti.png') # 仙人掌 ...@@ -14,6 +14,9 @@ cacti = pygame.image.load('cacti.png') # 仙人掌
apple = pygame.image.load('bush.png') # 灌木丛 apple = pygame.image.load('bush.png') # 灌木丛
hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.image.load('hero3.png'),pygame.image.load('hero4.png'),pygame.image.load('hero5.png')] # 创建猴子的动画载入列表 hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.image.load('hero3.png'),pygame.image.load('hero4.png'),pygame.image.load('hero5.png')] # 创建猴子的动画载入列表
# 初始化动画值
t = 30
# 初始化y值 # 初始化y值
y = 400 y = 400
...@@ -33,21 +36,25 @@ while True: ...@@ -33,21 +36,25 @@ while True:
jumpState = "up" jumpState = "up"
if jumpState == "up": if jumpState == "up":
if y > 150: if t > 0:
y -= 5 y -= t
t -= 2
else: else:
jumpState = "down" jumpState = "down"
if jumpState == "down": if jumpState == "down":
if y < 400: if t <= 30:
y += 5 y += t
t += 2
else: else:
jumpState = "runing" jumpState = "runing"
t = 30
# 添加动画判断数值 # 添加动画判断数值
if jumpState == "runing":
hero_sb = hero_sb + 1 hero_sb = hero_sb + 1
# 判断数值是否超过下标限制 # 判断数值是否超过下标限制
......
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