04 Stage
In this chapter, we will implement the stage drawing function.
Existing Sprite
The shared Skin already declares the judgment line sprite from play mode. This code is for reference. Do not edit guide/lib/skin.py:
python
from sonolus.script.sprite import StandardSprite, skin
@skin
class Skin:
# ...
judge_line: StandardSprite.JUDGMENT_LINEStage Drawing Function
Create guide/tutorial/stage.py with the following drawing function:
python
from sonolus.script.quad import Rect
from guide.lib.layout import Config
from guide.lib.skin import Skin
def draw_stage():
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)The z value places the judgment line in layer 0.
Updating
Replace guide/tutorial/update.py with the following code so the stage is drawn every frame:
python
from guide.tutorial.stage import draw_stage
def update():
draw_stage()The tutorial now displays the judgment line.