21. Individual Fall Speed
In this chapter, we will add individual fall speed to Note.
Individual Fall Speed
Individual fall speed is another common feature in rhythm games, where each note may fall at different speed. In some games, fall speed of a note is determined by the BPM, while in other games it can be manually adjusted to create fancy effects.
In our engine, we are going to take the approach of varying fall speed based on BPM.
Currently the fall speed is the same for all notes, because note position is lerped between minimum and maximum visual time, and minimum visual time is simply fixed 1 second before maximum visual time. To vary fall speed, we can simply vary the fall time.
Let's say we want 120 BPM correspond to 1 second fall time, and inversely scale with BPM (for example 240 BPM corresponds to 0.5 second fall time)
export class Note extends Archetype {
// ...
preprocess() {
// ...
this.visualTime.copyFrom(
Range.l
.mul(120 / bpmChanges.at(this.import.beat).bpm)
.add(timeScaleChanges.at(this.targetTime).scaledTime),
)
// ...
}
// ...
}
export class Note extends Archetype {
// ...
preprocess() {
// ...
this.visualTime.copyFrom(
Range.l
.mul(120 / bpmChanges.at(this.import.beat).bpm)
.add(timeScaleChanges.at(this.targetTime).scaledTime),
)
// ...
}
// ...
}