09 Particle Effect
In this chapter, we will spawn a hit particle when a note reaches the judgment line.
Shared Particle
The play section already declared Particles.note. Watch mode reuses that particle effect.
Playing
Unlike in play mode, where the tap triggers the particle effect, watch mode spawns the effect from terminate when the note leaves its active range.
Edit guide/watch/note.py. Add is_skip to the existing runtime import and add the shared particle import:
python
from sonolus.script.runtime import is_skip, scaled_time
from guide.lib.particle import ParticlesThen add terminate after update_parallel:
python
class WatchNote(WatchArchetype):
# ...
def terminate(self):
if is_skip():
return
particle_layout = Rect.from_center(
Vec2(0, 1),
Vec2(4 * Config.note_radius, -4 * Config.note_radius),
)
Particles.note.spawn(particle_layout, duration=0.3)Seeking can also make a note leave its active range. is_skip() identifies that transition so it does not create a false hit effect. At this checkpoint, replay misses still produce particles. Chapter 10 will suppress them after the recorded judgment is available.
Let a note reach the line without seeking: it should produce a particle. Then seek across a note in either direction: the skipped note should not produce a particle.