Commit d7de1414 by BellCodeEditor

save project

parent 5e1ac9b5
Showing with 9 additions and 5 deletions
...@@ -19,28 +19,32 @@ hero = [pygame.image.load('hero1.png'), ...@@ -19,28 +19,32 @@ hero = [pygame.image.load('hero1.png'),
index = 0 index = 0
zhuangtai = "running" zhuangtai = "running"
y = 400 y = 400
nu = 30
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event.type ==locals.KEYDOWN: if event.type ==locals.KEYDOWN:
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
zhuangtai = "up" zhuangtai = "up"
if zhuangtai == "up": if zhuangtai == "up":
if y > 150: if nu > 0:
y-=5 y -= nu
nu -=2
else: else:
zhuangtai = "down" zhuangtai = "down"
if zhuangtai == "down": if zhuangtai == "down":
if y < 400: if nu <= 30:
y += 5 y += nu
nu += 2
else: else:
zhuangtai = "running" zhuangtai = "running"
nu = 30
wukong = hero[index] wukong = hero[index]
index += 1 index += 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