06 Note Drawing
In this chapter, we will draw each note as it moves toward the judgment line.
Skin Sprite
The play section already declared Skin.note. Watch mode reuses that sprite.
Drawing
Edit guide/watch/note.py. Add the following imports to their existing import groups:
python
from sonolus.script.quad import Rect
from sonolus.script.runtime import scaled_time
from sonolus.script.vec import Vec2
from guide.lib.layout import Config
from guide.lib.skin import SkinThen add update_parallel after despawn_time:
python
class WatchNote(WatchArchetype):
# ...
def update_parallel(self):
y = self.visual_time.unlerp(scaled_time())
layout = Rect.from_center(
Vec2(0, y),
Vec2(2 * Config.note_radius, -2 * Config.note_radius),
)
Skin.note.draw(layout, z=(1, -self.target_time))visual_time.unlerp(scaled_time()) maps the note's active interval to a vertical position from 0 to 1. The note therefore reaches the judgment line at the end of its lifetime. The first value in the z tuple sets the layer. When notes share layer 1, -self.target_time places earlier notes above later notes.
Reload Watch. Notes should move from their spawn position above the play area to the judgment line, but they should not produce sounds or particles yet.