Files

26 lines
914 B
GDScript

## Contain a subset of notes in a [NoteArray].
## Notes are expected to be sorted in ascending order by beat.
## The original index of a note can be found with [method id_at].
class_name NoteSubset extends NoteArray
## The array where notes in this subset come from.
var full_set: NoteArray
## The ID (index of note in full_set) of the note at [param index].
func id_at(index) -> int:
return _ids.get(index)
## Parse the given [param notes] and return a [class NoteSubset]
## containing only notes in [param lane].
static func get_notes_in_lane(notes: NoteArray, lane: int) -> NoteSubset:
var lane_notes: NoteSubset = NoteSubset.new()
lane_notes.full_set = notes
for i in range(notes.size( )):
if notes.lane_at(i) == lane:
lane_notes._ids.append(i)
lane_notes.append_note_data(notes.beat_at(i), notes.type_at(i), lane)
return lane_notes
## ====== IMPLEMENTATION ====== #
var _ids: Array[int] = []