Commit b62c88cd by BellCodeEditor

save project

parent 8ed3ebba
Showing with 21 additions and 8 deletions
print('hello world')
\ No newline at end of file
......@@ -19,6 +19,11 @@ pygame.image.load('hero5.png')]
index = 0
y=400
zzz='runing'
t=30
zaw=random.choice([stone,cacti,apple])
rect=zaw.get_rect
rect.x=1000
rect.y=500-rect.height
while True:
for event in pygame.event.get():
......@@ -26,25 +31,31 @@ while True:
# 接收到退出事件后退出程序
exit()
if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE:
if event.key == locals.K_SPACE and zzz=='runing':
zzz='up'
if zzz=='up':
if y>150:
y-=30
if t>=0:
y-=t
t-=2
else:
zzz='down'
if zzz=='down':
if y<400:
y+=20
if t<=30:
y+=t
t+=2
else:
zzz='runing'
t = 30
if rect=
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(hero[index], (150, y))
index+=1
if index>4:
index=0
if zzz== 'runing':
index+=1
if index>4:
index=0
# 刷新画面
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