Commit c97b323a by BellCodeEditor

save project

parent febe6f8e
Showing with 16 additions and 12 deletions
import pygame
from pygame import locals
pygame.init()
screen = pygame.display.set_mode((1000,600))
FPS = pygame.time.Clock()
pygame.dispplay.set_caption("悟空跑酷")
backpround = pygame.image.load('bg.png')
road = pygame.image.load('road.png')
stond = pygame.image.load('stomd.png')
cacti = pygame.image.load('cacty.png')
apple = pygame.image.load('apple.png')
hero = [pygame.image.load('hero1.png')
pygame.image.load('hero2.png')
......@@ -15,10 +5,25 @@ hero = [pygame.image.load('hero1.png')
pygame.image.load('hero4.png')
pygame.image.load('hero5.png')]
index = 0
jumpState = "runing"
y = 400
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
if event.type == locaols.K_SPACE:
if event.key == locals.K_SPAE:
jumpState = "up"
if jumpStare == "up":
if y > 150:
y -= 5
else:
jumpState = "down":
if jumState == "down":
if y < 400:
y += 5
else:
jumpState = "runing"
wukon = hero[index]
index += 1
if index == 5:
......@@ -27,4 +32,4 @@ while True:
screen.blit(road,(0,500))
screen.blit(wukong,(150,400))
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
FPS.tick(60)
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