Commit baddda33 by BellCodeEditor

auto save

parent b9c60ac5
Showing with 8 additions and 4 deletions
...@@ -13,11 +13,11 @@ cacti = pygame.image.load('cacti.png') # 仙人掌 ...@@ -13,11 +13,11 @@ 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
pygame.display.set_caption("悟空跑酷") pygame.display.set_caption("杨佳宁跑酷")
y=400 y=400
w="run" w="run"
t=30 t=30
stone_x=1000
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -25,14 +25,17 @@ while True: ...@@ -25,14 +25,17 @@ while True:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE: if w =="run":
w="up" if event.key == locals.K_SPACE:
w="up"
if w=='up': if w=='up':
if t>0: if t>0:
y-=t y-=t
t-=2 t-=2
else: else:
w="down" w="down"
if w=="down": if w=="down":
if t<=30: if t<=30:
y+=t y+=t
...@@ -45,6 +48,7 @@ while True: ...@@ -45,6 +48,7 @@ while True:
index=index+1 index=index+1
if index>=5: if index>=5:
index=0 index=0
y=400
screen.blit(background,(0,0)) screen.blit(background,(0,0))
screen.blit(road, (0, 500)) screen.blit(road, (0, 500))
......
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