Commit b0133c06 by BellCodeEditor

save project

parent 0ad90eba
Showing with 75 additions and 39 deletions
......@@ -39,9 +39,12 @@ index = 0
heroLength = len(hero)
state = "runing"
t = 40
d = 40
f = 40
v = 30
d = 36
f = 36
v = 40
k = 40
o = 36
p = 38
block_list = pygame.sprite.Group()
time = 0
road_x = 0
......@@ -59,68 +62,101 @@ while True:
exit()
if event.type == locals.KEYDOWN and state == "runing":
if event.key == locals.K_w:
state = "up"
if event.key == locals.K_s:
state = "s"
if event.key == locals.K_d:
state = "d"
if event.key == locals.K_d:
state = "s"
if event.key == locals.K_e:
state = "l"
if event.key == locals.K_a:
state = "x"
if event.key == locals.K_s:
state = "z"
speed = 8 + score//3
#w
if state == "up" :
if t > 0:
wukong.rect.y -= t
t -= 2
else:
state = "down"
if state == "down" :
if t <= 40:
wukong.rect.y += t
t += 2
else:
state = "runing"
t -= 2
#s
#d遁地
if state == "s" :
if d > 0:
wukong.rect.y += d
d -= 2
if v > 0:
wukong.rect.y += v
v -= 2
else:
state = "e"
if state == "e" :
if d <= 40:
if v <= 40:
wukong.rect.y -= t
d += 2
f -= 2
v += 2
k -= 2
else:
state = "f"
if state == "f" :
if f <= 40:
wukong.rect.y += f
f += 2
state = "m"
if state == "m" :
if k <= 40:
wukong.rect.y += k
k += 2
else:
wukong.rect.y = 400
state = "runing"
#d
if state == "d" :
#e凌波微步
if state == "l" :
if d > 0:
wukong.rect.y -= d
d -= 2
else:
state = "q"
if state == "q" :
if d <= 40:
state = "jj"
if state == "jj" :
if d <= 36:
d += 2
f -= 2
else:
state = "o"
if state == "o":
if f <= 40:
if f <= 36:
wukong.rect.y += f
f += 2
else:
wukong.rect.y = 400
state = "runing"
#a小
if state == "x" :
if o > 0:
wukong.rect.y -= o
o -= 2
else:
state = "p"
if state == "p":
if o <= 36:
wukong.rect.y += o
o += 2
else:
state = "runing"
o -= 2
#s中
if state == "z" :
if p > 0:
wukong.rect.y -= p
p -= 2
else:
state = "q"
if state == "q":
if p <= 38:
wukong.rect.y += p
p += 2
else:
state = "runing"
p -= 2
#w大
if state == "d" :
if t > 0:
wukong.rect.y -= t
t -= 2
else:
state = "down"
if state == "down" :
if t <= 40:
wukong.rect.y += t
t += 2
else:
state = "runing"
t -= 2
#
if gameState == True:
wukong.image = hero[index]
......
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