From 81c8374058d8f40cff080ff36b3e58e96ea496a2 Mon Sep 17 00:00:00 2001 From: Turtike Date: Thu, 29 Jan 2026 21:27:08 +0800 Subject: [PATCH] Implement setting notes behaviour for ScoreArray. --- rhythm_game/note/score/score_array.gd | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rhythm_game/note/score/score_array.gd b/rhythm_game/note/score/score_array.gd index aac2a48..c26a8d5 100644 --- a/rhythm_game/note/score/score_array.gd +++ b/rhythm_game/note/score/score_array.gd @@ -1,10 +1,21 @@ class_name ScoreArray extends Node +## The note array this score refers to. +## WARNING: Changing the note data clears all scores. var notes: NoteArray: set = _set_notes +## Set a score for the note at [param index] in [member notes]. +## [param offset] is how off the note hit was in seconds. +func set_score(index: int, offset: float) -> void: + _scores.set(index, offset) + # ======== IMPLEMENTATION ======== # -var scores: Array[Note.SCORE] +var _scores: Array[float] func _set_notes(p_notes: NoteArray) -> void: + if notes == p_notes: + return notes = p_notes + _scores.clear() + _scores.resize(notes.size())