Commit ca8ad58e by BellCodeEditor

auto save

parent 64fbac97
Showing with 41 additions and 5 deletions
...@@ -16,17 +16,53 @@ hero = [pygame.image.load('hero1.png'), ...@@ -16,17 +16,53 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')] pygame.image.load('hero5.png')]
j = 0 j = 0
y=400
stone_x=1000
jumpState="running"
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()
j += 1 if event.type==locals.KEYDOWN:
if j == 5: if event.key==locals.K_SPACE:
j=1 jumpState="up"
if jumpState=="up":
if y>10:
y-=10
else:
jumpState="down"
if jumpState=="down":
if y<400:
y+=0.1
else:
jumpState=="running"
if jumpState=="running":
j += 1
if j >= 5:
j=1
else:
j=2
screen.blit(background, (0,0)) screen.blit(background, (0,0))
screen.blit(road, (0,500)) screen.blit(road, (0,500))
screen.blit(hero[j], (150,400)) screen.blit(hero[j], (150,y))
screen.blit(stone, (stone_x,400))
stone_x-=1
screen.blit(stone, (stone_x,400))
stone_x-=2
screen.blit(stone, (stone_x,400))
stone_x-=3
screen.blit(stone, (stone_x,400))
stone_x-=4
screen.blit(stone, (stone_x,400))
stone_x-=5
screen.blit(stone, (stone_x,400))
stone_x-=6
screen.blit(stone, (stone_x,400))
stone_x-=7
screen.blit(cacti, (0,400))
screen.blit(bush, (0,400))
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
......
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