命名一个科学场景

naming an asciimatics scene

我正在尝试制作一款有战斗力的游戏。为此,我需要循环遍历某个场景,直到玩家或怪物的健康值为 0 或更小。所以我设置了变量以在变量达到 0 后播放下一个场景(这是我想要循环的同一场景)。但问题是我不知道如何命名场景。这是我的代码:

def whack(self, sound):
    global PL, KL, SL, BL
    x, y = self._path.next_pos()
    if self.overlaps(PLAYER, use_new_pos=True):
        PL += 1
        raise NextScene
    if self.overlaps(SMOLFUNGI, use_new_pos=True):
        SL -= 1
        raise NextScene('the scene that is looping')
    else:
        self._scene.add_effect(Print(
            self._screen,
            SpeechBubble(sound), y, x, clear=True, delete_count=50))
    if PL < 1:
        raise StopApplication
    if SL < 1:
        raise NextScene

# Scene 7.
path = Path()
path.jump_to(podium[0], podium[1])

effects = [
    Print(screen,
    Box(screen.width, screen.height, uni=screen.unicode_aware),
    0, 0, start_frame=1),
      Print(screen, StaticRenderer(images=Grass),
    x=screen.width - 140,
    y=screen.height - 6,
      colour=Screen.COLOUR_WHITE),
    SMOLFUNGI,
    PLAYER,
    cross_hairs,
]
scenes.append(Scene(effects, -1))

它只是场景对象的一个​​参数。有关如何使用它们的说明,请阅读文档中的相关部分 (https://asciimatics.readthedocs.io/en/stable/widgets.html#exceptions)。

关键示例如下

# Given this scene list...
scenes = [
    Scene([ListView(screen, contacts)], -1, name="Main"),
    Scene([ContactView(screen, contacts)], -1, name="Edit Contact")
]
screen.play(scenes)

# You can use this code to move back to the first scene at any time...
raise NextScene("Main")