Commit 58f8da0f by BellCodeEditor

save project

parent 83816a98
Showing with 7 additions and 4 deletions
import pygame
from pygame import locals
import random
pygame.init()
class Block(pygame.sprite.Sprite):
......@@ -36,15 +37,15 @@ hero = [pygame.image.load('hero1.png'),
index = 0
bg_x = 0
road_x = 0
lu_x=0
y = 400
jumpState = "runing"
t = 30
time = 0
block_list = pygame.sprite.Group()
gamestate = True
block_list = pygame.sprite.Group()
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -63,12 +64,14 @@ while True:
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
wukong.rect.y = y
t -= 2
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 30:
y += t
wukong.rect.y = y
t += 2
else:
jumpState = "runing"
......@@ -114,4 +117,4 @@ while True:
#screen.blit(obstacle, (rect.x, rect.y))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
FPS.tick(50)
\ No newline at end of file
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