Commit 56247c9c by BellCodeEditor

save project

parent 381b4499
Showing with 11 additions and 5 deletions
......@@ -4,7 +4,7 @@ from pygame import locals
pygame.init() # 初始化
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600))
screen = pygame.display.set_mode((1500, 600))
pygame.display.set_caption("悟空取经")
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 载入图片
......@@ -26,6 +26,7 @@ x1=1000
jump_state = "running"
t=30
list1index=random.choice(list1)
ang=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -35,10 +36,12 @@ while True:
if jump_state=="running":
if event.key == locals.K_SPACE:
jump_state = "up"
if jump_state =="up":
if t>=0:
y-=t
t-=2
t-=2
ang+=69
else:
jump_state="down"
if jump_state =="down":
......@@ -47,11 +50,12 @@ while True:
t+=2
else:
jump_state="running"
ang=0
y=400
t=30
if x1<0-rect.w:
x1=1000
x1=1500
list1index=random.choice(list1)
......@@ -63,13 +67,15 @@ while True:
if jump_state=="running":
index+=1
if index==5:
index=1
index=0
wukong=hero[index]
# 将背景图画上去
wukong_now=pygame.transform.rotate(wukong,ang)
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong, (150, y))
screen.blit(wukong_now, (150, y))
screen.blit(list1index,(x1,400))
# 刷新画面
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