Organize files. WIP score system.

This commit is contained in:
2026-01-29 00:20:56 +08:00
parent 051ca8bcd8
commit fd5ee404d7
14 changed files with 17 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
## An array of notes, stored as arrays of data.
## Notes are assumed to be sorted in ascending order by beat.
class_name NoteArray extends Node
## The ID of the note at [param index].
func id_at(index: int) -> int:
return index
## The beat of the note at [param index].
func beat_at(index: int) -> float:
return _beats.get(index)
## The type of the note at [param index].
func type_at(index: int) -> Note.TYPE:
return _types.get(index)
## The lane of the note at [param index].
func lane_at(index: int) -> int:
return _lanes.get(index)
## The number of notes in the array.
func size() -> int:
return _beats.size()
## Remove all notes in the array.
func clear() -> void:
_beats = []
_types = []
_lanes = []
# ======= IMPLEMENTATION ======= #
var _beats: Array[float] = []
var _types: Array[Note.TYPE] = []
var _lanes: Array[int] = []
func _append_note(note: Note) -> void:
_beats.append(note.hit_beat)
_types.append(note.type)
_lanes.append(note.lane)
func _append_note_data(beat: float, type: Note.TYPE, lane: int) -> void:
_beats.append(beat)
_types.append(type)
_lanes.append(lane)

View File

@@ -0,0 +1 @@
uid://8isyo4pxyj1r

View File

@@ -0,0 +1,25 @@
## 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] = []

View File

@@ -0,0 +1 @@
uid://dhaxabkmyajjv