Commit 92662126 by BellCodeEditor

auto save

parent 7fdd198f
Showing with 15 additions and 18 deletions
...@@ -53,6 +53,10 @@ dw,s=150,0 ...@@ -53,6 +53,10 @@ dw,s=150,0
time=0 time=0
PS=60 PS=60
gametate=True gametate=True
yy=0
yyy=8
clock=1
l=0
class Rsc(pygame.sprite.Sprite): class Rsc(pygame.sprite.Sprite):
def __init__(self,im1,im2,im3): def __init__(self,im1,im2,im3):
...@@ -74,8 +78,8 @@ blist=pygame.sprite.Group() ...@@ -74,8 +78,8 @@ blist=pygame.sprite.Group()
while True: while True:
wukong=heros(hero[index]) wukong=heros(hero[index])
print(G) print(clock)
time+=1 time+=0.5*clock
if time>=60: if time>=60:
a=randint(1,60) a=randint(1,60)
if a>=20: if a>=20:
...@@ -103,13 +107,6 @@ while True: ...@@ -103,13 +107,6 @@ while True:
if IM!='running' and I_M>=1: if IM!='running' and I_M>=1:
if event.key == locals.K_w: if event.key == locals.K_w:
IM='dup' IM='dup'
I_M=0
G+=2
if index<=4:
index+=1
if index==5:
index=1
dws=150,y
if gametate==True: if gametate==True:
if IM=='up': if IM=='up':
y-=G y-=G
...@@ -118,7 +115,8 @@ while True: ...@@ -118,7 +115,8 @@ while True:
if G<= -42: if G<= -42:
IM='running' IM='running'
G=40 G=40
if IM=='dup':
wukong.rect.y=75
# if IM=='down': # if IM=='down':
# if G==0: # if G==0:
# y+=G # y+=G
...@@ -136,11 +134,11 @@ while True: ...@@ -136,11 +134,11 @@ while True:
herorun=hero[index] herorun=hero[index]
# 将背景图画上去 # 将背景图画上去
bg_x-=1 bg_x-=(2+0.25*clock)
if bg_x<=-1000: if bg_x<=-1000:
bg_x=0 bg_x=0
screen.blit(bg, (bg_x, 0)) screen.blit(bg, (bg_x, 0))
rond_x-=8 rond_x-=(8+0.5*clock)
if rond_x<= -1000: if rond_x<= -1000:
rond_x=0 rond_x=0
screen.blit(road, (rond_x, 500)) screen.blit(road, (rond_x, 500))
...@@ -148,16 +146,15 @@ while True: ...@@ -148,16 +146,15 @@ while True:
# if obg.rect.x<0-obg.rect.height: # if obg.rect.x<0-obg.rect.height:
# obg=Rsc(stone,cacti,apple) # obg=Rsc(stone,cacti,apple)
for pop in blist: for pop in blist:
pop.rect.x-=8 pop.rect.x-=(8+clock)
screen.blit(pop.image,(pop.rect.x,pop.rect.y)) screen.blit(pop.image,(pop.rect.x,pop.rect.y))
if pygame.sprite.collide_rect(wukong,pop): if pygame.sprite.collide_rect(wukong,pop):
screen.blit(go,(400,200)) screen.blit(go,(400,200))
gametate=False gametate=False
for event in pygame.event.get(): else:
if event.type == locals.KEYDOWN: if (pop.rect.x+pop.rect.y)<wukong.rect.x-wukong.rect.height:
if event.key==locals.K_r: clock+=0.1
gametate=True
pygame.sprite.kill(pop)
# 刷新画面 # 刷新画面
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