Skip to content

Commit 62da2f7

Browse files
committed
player can place notes
notes that have been added by the player only appear when they are about 1/3rd of the way through the track
1 parent 9b9a4fb commit 62da2f7

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

scenes/BattleDirector/BattleDirector.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public struct SongData
3535
}
3636

3737
private SongData _curSong;
38+
3839
//Assume queue structure for notes in each lane.
3940
private readonly Note[][] _laneNotes = new Note[][]
4041
{
@@ -64,7 +65,8 @@ public override void _Process(double delta)
6465
double curBeat = TimeKeeper.CurrentTime / (60 / (double)_curSong.Bpm);
6566
for (int i = 0; i < _laneNotes.Length; i++)
6667
{
67-
if (_laneNotes[i].Length <= 0) continue;
68+
if (_laneNotes[i].Length <= 0)
69+
continue;
6870
double beatDif = (curBeat - _laneNotes[i].First().Beat);
6971
if (beatDif > 1)
7072
{
@@ -105,9 +107,7 @@ private void OnNotePressed(NoteArrow.ArrowType type)
105107
CheckNoteTiming(type);
106108
}
107109

108-
private void OnNoteReleased(NoteArrow.ArrowType arrowType)
109-
{
110-
}
110+
private void OnNoteReleased(NoteArrow.ArrowType arrowType) { }
111111

112112
private void handleTiming(NoteArrow.ArrowType type, double beatDif)
113113
{
@@ -144,12 +144,28 @@ private void CheckNoteTiming(NoteArrow.ArrowType type)
144144
{
145145
double curBeat = TimeKeeper.CurrentTime / (60 / (double)_curSong.Bpm);
146146
if (_laneNotes[(int)type].Length == 0)
147+
{
148+
PlayerAddNote(type, (int)curBeat, 100); // 100 is temp, replace with current combo
147149
return;
150+
}
148151
double beatDif = Math.Abs(curBeat - _laneNotes[(int)type].First().Beat);
149152
if (beatDif > 1)
153+
{
154+
PlayerAddNote(type, (int)curBeat, 100); // 100 is temp, replace with current combo
150155
return;
156+
}
151157
GD.Print("Note Hit. Dif: " + beatDif);
152158
CM.HandleNote(type);
153159
handleTiming(type, beatDif);
154160
}
161+
162+
private void PlayerAddNote(NoteArrow.ArrowType type, int beat, int currentCombo)
163+
{
164+
// can also add some sort of keybind here to also have pressed
165+
// in case the user just presses the note too early and spawns a note
166+
if (currentCombo >= 100)
167+
{
168+
CM.CreateNote(type, beat);
169+
}
170+
}
155171
}

scenes/ChartViewport/ChartManager.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,12 @@ public void HandleNote(ArrowType type)
115115

116116
public void OnNotePressed(ArrowType type)
117117
{
118-
if (_currentArrows[(int)type].Length == 0)
119-
return;
118+
// removed this bit of code, since placement only worked on lines that already
119+
// had arrows before the player added any. if needed we can add this back
120+
// once we use charts that have arrows in all 4 rows from the beginning
121+
//if (_currentArrows[(int)type].Length == 0)
122+
//return;
123+
120124
EmitSignal(nameof(NotePressed), (int)type);
121125
}
122126

0 commit comments

Comments
 (0)