Commit d6c7509d by BellCodeEditor

auto save

parent 83fb61bb
Showing with 18 additions and 8 deletions
...@@ -20,20 +20,30 @@ hero = [pygame.image.load('hero1.png'), ...@@ -20,20 +20,30 @@ hero = [pygame.image.load('hero1.png'),
index = 0 index = 0
jumpzt = "running" jumpzt = "running"
y = 400 y = 400
t = 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()
for event in pygame.locals.KEYDOWN:
if envet.key == locals.K_SPACE: if event.type == locals.KEYDOWN:
if jumpzt == "running": if event.key == locals.K_SPACE:
if y > 150: jumpzt = "up"
y -= 5 if jumpzt == "up":
else: if t > 0 :
y y -= t
if y < 400: t -= 2
else:
jumpzt = "down"
if jumpzt == "down":
y+=t
t+=2
else:
jumpzt = "running"
if y == 400:
t = 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