当前位置: 首页>>代码示例>>Python>>正文


Python Arena.start方法代码示例

本文整理汇总了Python中arena.Arena.start方法的典型用法代码示例。如果您正苦于以下问题:Python Arena.start方法的具体用法?Python Arena.start怎么用?Python Arena.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在arena.Arena的用法示例。


在下文中一共展示了Arena.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print

# 需要导入模块: from arena import Arena [as 别名]
# 或者: from arena.Arena import start [as 别名]
    print("\n\n", e)
    print("Install pillow first: pip3 install pillow\n\n")

for runde in range(0, runden):

    # Immer abwechselnd Spieler1 und Spieler2 laufen lassen
    if runde % 2 == 0:
        arena = Arena(algo1_mod, algo1_name, algo2_mod, algo2_name)
        a1 = algo1_stats
        a2 = algo2_stats
    else:
        arena = Arena(algo2_mod, algo2_name, algo1_mod, algo1_name)
        a1 = algo2_stats
        a2 = algo1_stats

    arena.start()

    punkte1 = []
    punkte2 = []

    print()
    print("Runde: ", runde)

    while arena.laueft_noch():
        p1, p2 = arena.aktualisiere()
        punkte1.extend(p1)
        punkte2.extend(p2)
        # print("Punkte: %s = %d, %s = %d" % (a1["name"], len(punkte1), a2["name"], len(punkte2)))
        time.sleep(.01)

    if img_support:
开发者ID:coderdojoka,项目名称:Materialien,代码行数:33,代码来源:start.py

示例2: Main

# 需要导入模块: from arena import Arena [as 别名]
# 或者: from arena.Arena import start [as 别名]

#.........这里部分代码省略.........
        self.accept("Credits-Back", self.request, ["Menu"])
        self.koScreen.hide()
        self.credits.show()

    def exitCredits(self):
        self.ignore("Credits-Back")
        self.credits.hide()

    def enterCharSelection(self):
        self.accept("CharSelection-Back", self.request, ["Menu"])
        self.accept("CharSelection-Start", self.request, ["LevelSelection"])
        self.charSelection.show()

    def exitCharSelection(self):
        self.ignore("CharSelection-Start")
        self.ignore("CharSelection-Back")
        self.charSelection.hide()
        self.selectedChar1 = self.charSelection.selectedCharacter1
        self.selectedChar2 = self.charSelection.selectedCharacter2

    def enterLevelSelection(self):
        self.accept("LevelSelection-Back", self.request, ["CharSelection"])
        self.accept("LevelSelection-Start", self.request, ["Game"])
        self.levelSelection.show()

    def exitLevelSelection(self):
        self.ignore("LevelSelection-Start")
        self.ignore("LevelSelection-Back")
        self.levelSelection.hide()

    def enterGame(self):
        # main game code should be called here
        self.arena = Arena(self.levelSelection.selectedLevel)
        self.arena.start()
        self.camera.setPos(0, -5, 1.25)
        self.player = Player(0, self.selectedChar1, "p1")
        self.player2 = Player(1, self.selectedChar2, "p2")
        self.player.setEnemy(self.player2.collisionNodeName)
        self.player2.setEnemy(self.player.collisionNodeName)
        self.player.start(self.arena.getStartPos(1))
        self.player2.start(self.arena.getStartPos(2))
        self.taskMgr.add(self.updateWorldCam, "world camera update task")
        self.accept("gameOver", self.gameOver)
        self.hud.show()
        def lifeChanged(charId, health):
            base.messenger.send(
                "hud_setLifeBarValue",
                [charId, health])
        self.accept("lifeChanged", lifeChanged)
        hide_cursor()
        if self.fightMusic.status() != AudioSound.PLAYING:
            self.fightMusic.play()
        if self.menuMusic.status() == AudioSound.PLAYING:
            self.menuMusic.stop()

    def exitGame(self):
        # cleanup for game code
        self.taskMgr.remove("world camera update task")
        self.player.stop()
        self.player2.stop()
        del self.player
        del self.player2
        self.arena.stop()
        self.ignore("gameOver")
        self.ignore("lifeChanged")
        self.hud.hide()
开发者ID:jorjuato,项目名称:panda3d-tutorial,代码行数:70,代码来源:main.py


注:本文中的arena.Arena.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。