Commit defd713a by BellCodeEditor

auto save

parent 3ac70f49
Showing with 13 additions and 5 deletions

10.9 KB | W: | H:

8.63 KB | W: | H:

hero2.png
hero2.png
hero2.png
hero2.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -7,7 +7,7 @@ pygame.init() # 初始化 ...@@ -7,7 +7,7 @@ pygame.init() # 初始化
screen = pygame.display.set_mode((1000, 600)) screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 载入图片 # 载入图片
pygame.display.set_cap pygame.display.set_caption('老八酷跑')
background = pygame.image.load('bg.png') # 背景 background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路 road = pygame.image.load('road.png') # 路
stone = pygame.image.load('stone.png') # 石头 stone = pygame.image.load('stone.png') # 石头
...@@ -19,7 +19,7 @@ hero = [pygame.image.load('hero1.png'), ...@@ -19,7 +19,7 @@ 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')]
index = 0 index = 0
jumpState == "runing" jumpState = "runing"
y = 400 y = 400
...@@ -29,13 +29,21 @@ while True: ...@@ -29,13 +29,21 @@ while True:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.ket == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState == "up" jumpState = "up"
if jumpState == "up": if jumpState == "up":
if y > 150: if y > 150:
y -= 5
else:
jumpState = "down"
if jumpState == "down":
if y < 400:
y += 5 y += 5
else: else:
jumpState == "down" jumpState = "runing"
......
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