コード例 #1
0
    def run_level_up(self):
        # 若处于前三关
        if self.level <= 3:
            self.buying = 0
            self.enemies.clear()
            self.enemy_count = 0
            self.last_enemy_time = 0
            self.towers.clear()
            if self.next_button.collidepoint(self.mouse_down_pos):
                sounds.starta.play(loops=0)
                music.set_volume(0.2)
                music.play("start.wav")
                self.begin_time = time.time()
                self.status = "playing"

        # 若处于彩蛋关卡
        elif self.level == 4:
            self.buying = 0
            self.enemies.clear()
            self.enemy_count = 0
            self.last_enemy_time = 0
            self.towers.clear()
            self.towers.append(Tower("virus4_1", (400, 325), 1))
            self.towers.append(Tower("virus4_0", (500, 200), 2))
            self.towers.append(Tower("virus4_1", (700, 450), 3))
            if self.next_button.collidepoint(self.mouse_down_pos):
                sounds.starta.play(loops=0)
                music.set_volume(0.2)
                music.play("start.wav")
                self.begin_time = time.time()
                self.status = "egg"
コード例 #2
0
 def restart(self):
     sounds.starta.play(loops=0)
     music.set_volume(0.4)
     music.play("start.wav")
     self.level = 1
     self.buying = 0
     self.lives = 3
     self.money = 50
     self.enemies.clear()
     self.enemy_count = 0
     self.last_enemy_time = 0
     self.towers.clear()
コード例 #3
0
ファイル: main.py プロジェクト: Guihudge/Projet-ISN-2020
def menu():
    global play
    if not music.is_playing("test"):
        music.play("test")
    screen.clear()
    screen.fill((255, 255, 255))
    screen.blit("logo_menu", ((WIDTH / 2) - 441, (HEIGHT / 2) - 360))

    screen.draw.text(u"MEURTRE A EIFFEL", ((WIDTH / 2) - 250, 100),
                     color="red",
                     fontname="algeria",
                     fontsize=60)

    screen.draw.text(u"Appuyer sur entrée pour jouer",
                     ((WIDTH / 2) - 250, HEIGHT - 200),
                     color="red",
                     fontsize=60)

    if keyboard.RETURN:
        play = True
        time.sleep(dead_time)
コード例 #4
0
    def __init__(self):
        self.begin_time = time.time()
        self.status = "begin"
        self.level = 1
        self.buying = 0
        self.mouse_down_pos = (0, 0)
        self.mouse_move_pos = (0, 0)
        self.lives = 3
        self.money = 500
        self.enemies = []
        self.enemy_count = 0
        self.last_enemy_time = 0
        self.towers = []

        # 音乐
        music.set_volume(0.4)
        music.play("start.wav")

        # 共用界面
        self.back_button = Actor("back_button", (50, 50))
        # 开始界面
        self.begin_button = Actor("begin_button", (500, 425))
        # 帮助界面
        self.help_button = Actor("help_button", (500, 550))
        # 升级界面
        self.egg_button = Actor("egg_button", (100, 400))
        # 游戏中
        self.buy_tower1 = Actor("tower1", (450, 650))
        self.buy_tower2 = Actor("tower2", (625, 650))
        self.buy_tower3 = Actor("tower3", (825, 650))
        self.hint = Actor("tower1", (0, 0))
        self.pause_button = Actor("pause_button", (100, 200))
        self.start_button = Actor("start_button", (100, 300))
        self.next_button = Actor("next_button", (100, 400))
        # 彩蛋
        self.buy_pkuer = Actor("pkuer2", (700, 650))
コード例 #5
0
            game.play_sound = False
        if game.gameOn == 3:
            sounds.game_win.play()
            game.play_sound = False
        if game.gameOn == 4:
            sounds.game_victory.play()
            game.play_sound = False

    if game.gameOn == 1.5 and game.play_sound == False:
        game.play_sound = True

    game.checkGameOver()


# bgm播放
music.play("bgm")
music.unpause()

Allmask = []  # 界面上存在的口罩列表
Alldis = []  # 界面上存在的消毒水列表
Allgate = []  # 传送门列表
gate_location = []  # 传送门位置列表
Allcell = []  # 积分道具列表
Vaccinelist = []  # 疫苗列表
Allgrade = {}  # 积分列表
Rank_list = []  # 排行榜数据列表

# 游戏参数设定
num = 6
index = 6
step = 50
コード例 #6
0
ファイル: musica.py プロジェクト: yrobla/pyjuegos
def suena(name):
    music.play(name)