Commit 381bbcb7 by BellCodeEditor

auto save

parent 52bae3ac
Showing with 21 additions and 16 deletions
......@@ -9,6 +9,14 @@ class Block (pygame.sprite.Sprite):
self.rect = self.image.get_rect()
self.rect.x = 1000
self.rect.y = 500 - self.rect.height
class Wu(pygame.sprite.Sprite):
def __init__(self , image):
super().__init__()
self.image = image
self.rect = self.image.get_rect()
self.rect.x = 150
self.rect.y = 400
pygame.init() # 初始化
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600))
......@@ -19,11 +27,11 @@ road = pygame.image.load('road.png') # 路
stone = pygame.image.load('stone.png') # 石头
cacti = pygame.image.load('cacti.png') # 仙人掌
bush = pygame.image.load('bush.png') # 灌木丛
hero = [pygame.image.load('stone.png'),
pygame.image.load('stone.png'),
pygame.image.load('stone.png'),
pygame.image.load('stone.png'),
pygame.image.load('stone.png')]
hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero2.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
pygame.display.set_caption("一只猴的回家路")
index = 0
heroLength = len(hero)
......@@ -32,7 +40,6 @@ y = 400
t = 30
d = 30
f = 30
g = 150
block_list = pygame.sprite.Group()
time = 0
road_x = 0
......@@ -73,7 +80,7 @@ while True:
else:
state = "e"
if state == "e" :
if d <= 34:
if d <= 30:
y -= t
d += 2
f -= 2
......@@ -88,21 +95,19 @@ while True:
state = "runing"
#d
if state == "d" :
if g > 0:
if d > 0:
y -= d
d -= 2
g -= 10
else:
state = "q"
if state == "q" :
if g <= 300:
d = 30
f = 0
g -= 10
if d <= 30:
d += 2
f -= 2
else:
state = "g"
if state == "g" :
if g <= 30:
state = "o"
if state == "o":
if f <= 30:
y += f
f += 2
else:
......
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