Commit 8838abdf by BellCodeEditor

auto save

parent 4aeacfdf
Showing with 18 additions and 17 deletions
...@@ -4,21 +4,6 @@ import random ...@@ -4,21 +4,6 @@ import random
import json import json
pygame.init() # 初始化 pygame.init() # 初始化
class Player(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
class Block(pygame.sprite.Sprite):#障碍物精灵
def __init__(self,image1,image2,image3):
super().__init__()
self.image=random.choice([image1,image2,image3])
self.rect=self.image.get_rect()
self.rect.x=1000
self.rect.y=500-self.rect.height
self.score=1
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((1000, 600))#窗口 screen = pygame.display.set_mode((1000, 600))#窗口
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
...@@ -35,6 +20,22 @@ hero = [pygame.image.load('hero1.png'), ...@@ -35,6 +20,22 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'), pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]#悟空造型列表 pygame.image.load('hero5.png')]#悟空造型列表
class Player(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
class Block(pygame.sprite.Sprite):#障碍物精灵
def __init__(self,image1,image2,image3):
super().__init__()
self.image=random.choice([image1,image2,image3])
self.rect=self.image.get_rect()
self.rect.x=1000
self.rect.y=500-self.rect.height
self.score=1
score_audio=pygame.mixer.Sound('score.wav')#得分音效 score_audio=pygame.mixer.Sound('score.wav')#得分音效
old_score=0 old_score=0
road_x=0 road_x=0
......
{"第1名": 91, "第2名": 86, "第3名": 13} {"第1名": 91, "第2名": 86, "第3名": 86}
\ No newline at end of file \ 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