Commit 4bb4f5aa by BellCodeEditor

save project

parent f9cff980
Showing with 7 additions and 6 deletions
......@@ -19,12 +19,13 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
#变量初始化
lu_x=0
shan_x=0
index = 0
y = 400
jumpState = "runing"
t = 60
t = 37
zhangaiwu=choice([bush,cacti,stone])#随机获得一个障碍物
xingzhuang=zhangaiwu.get_rect()#活得障碍物的坐标,宽,高。
xingzhuang.x=1000#使障碍物的x坐标为1000
......@@ -35,7 +36,7 @@ while True:
# 接收到退出事件后退出程序
exit()
if event.type == locals.KEYDOWN:
if jumpState == "runing":
if jumpState == "running":
if event.key == locals.K_SPACE:
jumpState = "up"
......@@ -46,16 +47,16 @@ while True:
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 60:
if t <= 37:
y += t
t += 2
else:
jumpState = "runing"
t =60
jumpState = "running"
t =37
# 悟空造型
wukong = hero[index]
if jumpState == "runing": # 跑步状态下
if jumpState == "running": # 跑步状态下
index += 1
if index >= 5:
index = 0
......
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