Commit 7ba77db5 by BellCodeEditor

auto save

parent 7d2ceb91
Showing with 34 additions and 9 deletions
...@@ -24,25 +24,50 @@ hero = [pygame.image.load('hero1.png'), ...@@ -24,25 +24,50 @@ hero = [pygame.image.load('hero1.png'),
shan_x = 0 shan_x = 0
lu_x = 0 lu_x = 0
zaoxin = 0
wukongstate = "run"
wukong_y = 400
y = 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.key == locals.K_SPACE:
wukongstate = "down"
if wukongstate == "down":
if wukong_y > 150:
wukong_y += y
y -= 5
else:
wukongstate == "up"
y = 30
if wukongstate == "up":
if wukong_y < 400:
wukong_y -= y
y += 5
else:
wukongstate == "run"
y = 30
shan_x += 2 shan_x -= 2
if shan_x < -1000: if shan_x < -1000:
shan_x=0 shan_x=0
screen.blit(background, (shan_x, 0)) screen.blit(background, (shan_x, 0))
lu_x -= 4
if lu_x < -1000:
lu_x=0
screen.blit(road, (lu_x, 500))
zaoxin += 1
if zaoxin == 5:
zaoxin = 0
screen.blit(hero[zaoxin],(100,wukong_y))
screen.blit(road,(0,500))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
......
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