Commit f14e2b25 by BellCodeEditor

save project

parent 881a8236
Showing with 17 additions and 9 deletions
...@@ -30,22 +30,25 @@ class Block(pygame.sprite.Sprite): ...@@ -30,22 +30,25 @@ class Block(pygame.sprite.Sprite):
self.rect=self.image.get_rect() self.rect=self.image.get_rect()
self.rect.x=1000+self.rect.width self.rect.x=1000+self.rect.width
self.rect.y=500-self.rect.height self.rect.y=500-self.rect.height
blocks=Block(grass,hole,stone,bush,cacti) blocks=Block(grass,hole,stone,bush,cacti)
clocks=Block(grass,hole,stone,bush,cacti)
clocks.rect.x+=400+random.randint(-400,400)
while True: while True:
##Shadow
shadow=1
if blocks.rect.x-450<=100 and state != "down":
state="up"
shadow=0
##Keys ##Keys
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.type == locals.KEYDOWN and shadow==1:
if state=="moving" and event.key==locals.K_UP: if state=="moving" and event.key==locals.K_UP:
state = "up" state = "up"
if state=="down" and event.key==locals.K_DOWN: if state=="down" and event.key==locals.K_DOWN:
pass pass
##Shadow
if blocks.rect.x-350<=50:
state="up"
##Action ##Action
if state=="up": if state=="up":
if t>0: if t>0:
...@@ -72,13 +75,17 @@ while True: ...@@ -72,13 +75,17 @@ while True:
i=0 i=0
if blocks.rect.x<0-blocks.rect.width: if blocks.rect.x<0-blocks.rect.width:
blocks=Block(grass,hole,stone,bush,cacti) blocks=Block(grass,hole,stone,bush,cacti)
##Play
blocks.rect.x-=30 blocks.rect.x-=30
if clocks.rect.x<0-clocks.rect.width:
clocks=Block(grass,hole,stone,bush,cacti)
clocks.rect.x+=400+random.randint(-400,400)
clocks.rect.x-=30
##Play
screen.blit(background, (bg_x, 0)) screen.blit(background, (bg_x, 0))
screen.blit(road, (road_x, 500)) screen.blit(road, (road_x, 500))
screen.blit(heroes[i], (150, y)) screen.blit(heroes[i], (150, y))
screen.blit(blocks.image,(blocks.rect.x,blocks.rect.y)) screen.blit(blocks.image,(blocks.rect.x,blocks.rect.y))
screen.blit(clocks.image,(clocks.rect.x,clocks.rect.y))
pygame.display.update() pygame.display.update()
FPS.tick(20) FPS.tick(20)
\ No newline at end of file
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