@@ -19,6 +19,8 @@ public partial class BattleDirector : Node2D
1919 private HealthBar Player ;
2020 private HealthBar Enemy ;
2121
22+ private NotePlacementBar NotePlacementBar ;
23+
2224 private double _timingInterval = .1 ; //secs
2325
2426 [ Signal ]
@@ -53,6 +55,7 @@ public override void _Ready()
5355
5456 Player = GetNode < HealthBar > ( "PlayerHP" ) ;
5557 Enemy = GetNode < HealthBar > ( "EnemyHP" ) ;
58+ NotePlacementBar = GetNode < NotePlacementBar > ( "NotePlacementBar" ) ;
5659
5760 CM . Connect ( nameof ( NoteManager . NotePressed ) , new Callable ( this , nameof ( OnNotePressed ) ) ) ;
5861 CM . Connect ( nameof ( NoteManager . NoteReleased ) , new Callable ( this , nameof ( OnNoteReleased ) ) ) ;
@@ -122,21 +125,25 @@ private void handleTiming(NoteArrow.ArrowType type, double beatDif)
122125 {
123126 GD . Print ( "Perfect" ) ;
124127 Enemy . TakeDamage ( 10 ) ;
128+ NotePlacementBar . HitNote ( ) ;
125129 }
126130 else if ( beatDif < _timingInterval * 4 )
127131 {
128132 GD . Print ( "Good" ) ;
129133 Enemy . TakeDamage ( 5 ) ;
134+ NotePlacementBar . HitNote ( ) ;
130135 }
131136 else if ( beatDif < _timingInterval * 6 )
132137 {
133138 GD . Print ( "Okay" ) ;
134139 Enemy . TakeDamage ( 1 ) ;
140+ NotePlacementBar . HitNote ( ) ;
135141 }
136142 else
137143 {
138144 GD . Print ( "Miss" ) ;
139145 Player . TakeDamage ( 10 ) ;
146+ NotePlacementBar . MissNote ( ) ;
140147 }
141148 }
142149
@@ -145,27 +152,37 @@ private void CheckNoteTiming(NoteArrow.ArrowType type)
145152 double curBeat = TimeKeeper . CurrentTime / ( 60 / ( double ) _curSong . Bpm ) ;
146153 if ( _laneNotes [ ( int ) type ] . Length == 0 )
147154 {
148- PlayerAddNote ( type , ( int ) curBeat , 100 ) ; // 100 is temp, replace with current combo
155+ PlayerAddNote ( type , ( int ) curBeat ) ;
149156 return ;
150157 }
151158 double beatDif = Math . Abs ( curBeat - _laneNotes [ ( int ) type ] . First ( ) . Beat ) ;
152159 if ( beatDif > 1 )
153160 {
154- PlayerAddNote ( type , ( int ) curBeat , 100 ) ; // 100 is temp, replace with current combo
161+ PlayerAddNote ( type , ( int ) curBeat ) ;
155162 return ;
156163 }
157164 GD . Print ( "Note Hit. Dif: " + beatDif ) ;
158165 CM . HandleNote ( type ) ;
159166 handleTiming ( type , beatDif ) ;
160167 }
161168
162- private void PlayerAddNote ( NoteArrow . ArrowType type , int beat , int currentCombo )
169+ private void PlayerAddNote ( NoteArrow . ArrowType type , int beat )
163170 {
171+ //TODO: notes currently can only be placed in first loop.
172+ // placed notes are also non-interactable
173+
164174 // can also add some sort of keybind here to also have pressed
165175 // in case the user just presses the note too early and spawns a note
166- if ( currentCombo >= 100 )
176+ GD . Print (
177+ $ "Player trying to place { type } typed note at beat: "
178+ + beat
179+ + " Verdict: "
180+ + NotePlacementBar . CanPlaceNote ( )
181+ ) ;
182+ if ( NotePlacementBar . CanPlaceNote ( ) )
167183 {
168184 CM . CreateNote ( type , beat ) ;
185+ NotePlacementBar . PlacedNote ( ) ;
169186 }
170187 }
171188}
0 commit comments