Skip to content

04 Stage

In this chapter, we will replace the template's stage debug output with the judgment line.

Lifetime

The stage must remain active throughout the level. The template already makes spawn_time and despawn_time return -999999 and 999999, which keep the Stage active throughout the level. Keep those callbacks unchanged.

Skin Sprite

The play section already declared Skin.judge_line. Watch mode uses the same Skin collection, so no new skin declaration is needed.

Drawing

Edit guide/watch/stage.py. Replace the debug_log and time imports and the debug implementation of update_parallel. The completed file should contain:

python
from sonolus.script.archetype import WatchArchetype
from sonolus.script.quad import Rect

from guide.lib import archetype_names
from guide.lib.layout import Config
from guide.lib.skin import Skin


class WatchStage(WatchArchetype):
    name = archetype_names.STAGE

    def spawn_time(self) -> float:
        return -999999

    def despawn_time(self) -> float:
        return 999999

    def update_parallel(self):
        layout = Rect(
            l=Config.judge_line_l,
            r=Config.judge_line_r,
            t=1 - Config.note_radius / 4,
            b=1 + Config.note_radius / 4,
        )
        Skin.judge_line.draw(layout, z=0, a=1)

Reload Watch: the debug time log should be gone, and the judgment line should remain visible while you seek through the level.