Skip to content

Commit 5b17978

Browse files
committed
Integrate and adjust NPB
Don't let the rewritten history fool you, NotePlacementBar was just integrated now. I need sleep.
1 parent b8c7ea1 commit 5b17978

5 files changed

Lines changed: 51 additions & 15 deletions

File tree

scenes/BattleDirector/BattleDirector.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public partial class BattleDirector : Node2D
1313
#region Declarations
1414
private HealthBar Player;
1515
private HealthBar Enemy;
16-
16+
1717
[Export]
1818
public ChartManager CM;
1919

@@ -94,6 +94,11 @@ private bool AddNoteToLane(Note note)
9494
//Creeate dummy notes
9595
private void AddExampleNotes()
9696
{
97+
for (int i = 0; i < 1; i++)
98+
{
99+
Note exampleNote = new Note(NoteArrow.ArrowType.Down, i + 5);
100+
AddNoteToLane(exampleNote);
101+
}
97102
for (int i = 0; i < 4; i++)
98103
{
99104
Note exampleNote = new Note(NoteArrow.ArrowType.Up, i + 20);
@@ -177,7 +182,10 @@ private void CheckNoteTiming(NoteArrow.ArrowType type)
177182
return;
178183
double beatDif = Math.Abs(curBeat - GetFirstNote(type).Beat);
179184
if (beatDif > 1)
185+
{
186+
PlayerAddNote(type, (int)Math.Round(curBeat));
180187
return;
188+
}
181189
GD.Print("Note Hit. Dif: " + beatDif);
182190
_laneData[(int)type].First().NoteHit();
183191
HandleTiming(type, beatDif);
@@ -215,11 +223,9 @@ private void HandleTiming(NoteArrow.ArrowType type, double beatDif)
215223

216224
private void PlayerAddNote(NoteArrow.ArrowType type, int beat)
217225
{
218-
//TODO: notes currently can only be placed in first loop.
219-
// placed notes are also non-interactable
220-
221226
// can also add some sort of keybind here to also have pressed
222227
// in case the user just presses the note too early and spawns a note
228+
//TODO: Sync new notes animations with the rest.
223229
GD.Print(
224230
$"Player trying to place {type} typed note at beat: "
225231
+ beat

scenes/BattleDirector/NotePlacementBar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public partial class NotePlacementBar : Node
1010
int notesToIncreaseCombo;
1111

1212
[Export]
13-
ProgressBar notePlacementBar;
13+
TextureProgressBar notePlacementBar;
1414

1515
[Export]
1616
TextEdit currentComboMultText;

scenes/BattleDirector/NotePlacementBar.tscn

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1-
[gd_scene load_steps=2 format=3 uid="uid://duhiilcv4tat3"]
1+
[gd_scene load_steps=6 format=3 uid="uid://duhiilcv4tat3"]
22

33
[ext_resource type="Script" path="res://scenes/BattleDirector/NotePlacementBar.cs" id="1_456es"]
44

5+
[sub_resource type="Gradient" id="Gradient_0u6yv"]
6+
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1)
7+
8+
[sub_resource type="GradientTexture2D" id="GradientTexture2D_hhds4"]
9+
gradient = SubResource("Gradient_0u6yv")
10+
width = 26
11+
height = 100
12+
13+
[sub_resource type="Gradient" id="Gradient_lyd0l"]
14+
offsets = PackedFloat32Array(0, 0.485915, 0.739437, 1)
15+
colors = PackedColorArray(0, 1, 0, 1, 0.68, 0, 0.272, 1, 0, 0.64, 0.608, 1, 0.4, 0, 0, 1)
16+
17+
[sub_resource type="GradientTexture2D" id="GradientTexture2D_k7kvy"]
18+
gradient = SubResource("Gradient_lyd0l")
19+
width = 24
20+
height = 98
21+
fill_to = Vector2(0, 1)
22+
523
[node name="NotePlacementBar" type="Control" node_paths=PackedStringArray("notePlacementBar", "currentComboMultText")]
624
layout_mode = 3
725
anchors_preset = 15
@@ -13,19 +31,20 @@ script = ExtResource("1_456es")
1331
notePlacementBar = NodePath("ProgressBar")
1432
currentComboMultText = NodePath("TextEdit")
1533

16-
[node name="ProgressBar" type="ProgressBar" parent="."]
34+
[node name="ProgressBar" type="TextureProgressBar" parent="."]
1735
layout_mode = 0
18-
offset_left = 29.0
19-
offset_top = 50.0
20-
offset_right = 229.0
21-
offset_bottom = 85.0
36+
offset_right = 26.0
37+
offset_bottom = 100.0
38+
fill_mode = 3
39+
texture_under = SubResource("GradientTexture2D_hhds4")
40+
texture_progress = SubResource("GradientTexture2D_k7kvy")
41+
texture_progress_offset = Vector2(1, 1)
2242

2343
[node name="TextEdit" type="TextEdit" parent="."]
2444
layout_mode = 0
25-
offset_left = 240.0
26-
offset_top = 50.0
27-
offset_right = 290.0
28-
offset_bottom = 85.0
45+
offset_top = -41.0
46+
offset_right = 50.0
47+
offset_bottom = -6.0
2948
mouse_filter = 2
3049
text = "x1"
3150
context_menu_enabled = false

scenes/BattleDirector/test_battle_scene.tscn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,7 @@ offset_right = 443.0
6363
SpriteText = ExtResource("6_0k4pw")
6464

6565
[node name="NotePlacementBar" parent="." instance=ExtResource("7_3ko4g")]
66+
offset_left = 12.0
67+
offset_top = 145.0
68+
offset_right = 12.0
69+
offset_bottom = 145.0

scenes/ChartViewport/ChartViewport.tscn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ handle_input_locally = false
1717
size = Vector2i(480, 220)
1818
render_target_update_mode = 4
1919

20+
[node name="ColorFill" type="ColorRect" parent="SubViewport"]
21+
z_index = -2
22+
offset_left = -30.0
23+
offset_right = 610.0
24+
offset_bottom = 360.0
25+
color = Color(0.258824, 0.290196, 0.392157, 1)
26+
2027
[node name="Camera2D" type="Camera2D" parent="SubViewport"]
2128
position = Vector2(-25, 0)
2229
anchor_mode = 0

0 commit comments

Comments
 (0)