Commit f8a18c3a by BellCodeEditor

auto save

parent f336371f
Showing with 5 additions and 11 deletions
...@@ -13,7 +13,7 @@ cacti = pygame.image.load('cacti.png') # 仙人掌 ...@@ -13,7 +13,7 @@ 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')]
index = 0 index = 0
QE='run' jump='runing'
y=400 y=400
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -22,19 +22,13 @@ while True: ...@@ -22,19 +22,13 @@ while True:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.type == locals.K_SPACE: if event.type == locals.K_SPACE:
QE='up' jump="up"
if QE=='up': QE='UP'
if jump=="up":
if y>150: if y>150:
y-=5 y-=5
else: else:
QE='down' jump="down"
if QE=='down':
if y>400:
y+=5
else:
QE='run'
lk=hero[index] lk=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