Skip to content

Commit 31e6304

Browse files
authored
Merge pull request #77 from Project-Funk-Engine/Note_Feedback
Note feedback
2 parents 12f211c + ae42dc9 commit 31e6304

File tree

13 files changed

+126
-20
lines changed

13 files changed

+126
-20
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@ Current team members include:
1515

1616
#### Attributions:
1717
First Song: <a href="https://freesound.org/people/Magntron/sounds/335571/" title="gameMusic">gameMusic by Magntron - freesound.org</a>
18-
Input buttons by <a href="https://thoseawesomeguys.com/prompts/" title="inputkeys">Nicolae (Xelu) Berbece</a>
19-
20-
18+
Input buttons by <a href="https://thoseawesomeguys.com/prompts/" title="inputkeys">Nicolae (Xelu) Berbece</a>

scenes/BattleDirector/NotePlacementBar.tscn

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ width = 32
2323
height = 98
2424
fill_to = Vector2(0, 1)
2525

26-
[node name="NotePlacementBar" type="Control" node_paths=PackedStringArray("notePlacementBar", "currentComboMultText", "_currentNote", "_nextNote")]
26+
[node name="NotePlacementBar" type="Control" node_paths=PackedStringArray("notePlacementBar", "currentComboMultText", "_currentNote", "_nextNote", "fullBarParticles")]
2727
layout_mode = 3
2828
anchors_preset = 15
2929
anchor_right = 1.0
@@ -35,6 +35,7 @@ notePlacementBar = NodePath("ProgressBar")
3535
currentComboMultText = NodePath("TextEdit")
3636
_currentNote = NodePath("NoteQueueSprite/NextNote")
3737
_nextNote = NodePath("NoteQueueSprite/CurrentNote")
38+
fullBarParticles = NodePath("ProgressBar/CPUParticles2D")
3839

3940
[node name="ProgressBar" type="TextureProgressBar" parent="."]
4041
layout_mode = 0
@@ -47,6 +48,19 @@ texture_under = SubResource("GradientTexture2D_hhds4")
4748
texture_progress = SubResource("GradientTexture2D_0bqho")
4849
texture_progress_offset = Vector2(1, 1)
4950

51+
[node name="CPUParticles2D" type="CPUParticles2D" parent="ProgressBar"]
52+
position = Vector2(14, 98)
53+
emitting = false
54+
amount = 10
55+
lifetime = 1.5
56+
direction = Vector2(0, -1)
57+
spread = 15.0
58+
gravity = Vector2(0, 0)
59+
initial_velocity_min = 25.0
60+
initial_velocity_max = 50.0
61+
scale_amount_max = 2.0
62+
color = Color(1, 1, 0.0745098, 1)
63+
5064
[node name="TextEdit" type="TextEdit" parent="."]
5165
z_as_relative = false
5266
layout_mode = 0

scenes/BattleDirector/scripts/BattleDirector.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,11 @@ private void OnTimedInput(Note note, ArrowType arrowType, int beat, double beatD
169169
else
170170
{
171171
note.OnHit(this, timed);
172+
172173
NotePlacementBar.HitNote();
173174
}
174-
NotePlacementBar.ComboText(timed.ToString());
175+
//NotePlacementBar.ComboText(timed.ToString());
176+
CM.ComboText(timed.ToString(), arrowType, NotePlacementBar.GetCurrentCombo());
175177
}
176178

177179
private Timing CheckTiming(double beatDif)

scenes/BattleDirector/scripts/NotePlacementBar.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public partial class NotePlacementBar : Node
2424
[Export]
2525
private Sprite2D _nextNote;
2626

27+
[Export]
28+
private CpuParticles2D fullBarParticles;
29+
2730
private Note[] _noteDeck;
2831
private Queue<Note> _noteQueue = new Queue<Note>();
2932

@@ -105,13 +108,6 @@ private Note GetNote(bool getNextNote = false)
105108
return result;
106109
}
107110

108-
public void ComboText(string text)
109-
{
110-
TextParticle newText = new TextParticle();
111-
AddChild(newText);
112-
newText.Text = text + $" {_currentCombo}";
113-
}
114-
115111
// Hitting a note increases combo, combo mult, and note placement bar
116112
public void HitNote()
117113
{
@@ -120,6 +116,7 @@ public void HitNote()
120116
_currentBarValue = Math.Min(_currentBarValue + comboMult, MaxValue);
121117
UpdateNotePlacementBar(_currentBarValue);
122118
UpdateComboMultText();
119+
//fullBarParticles.Emitting = CanPlaceNote();
123120
}
124121

125122
// Missing a note resets combo
@@ -136,6 +133,7 @@ public Note PlacedNote()
136133
_currentBarValue -= (int)(_currentNoteInstance.CostModifier * MaxValue);
137134

138135
UpdateNotePlacementBar(_currentBarValue);
136+
//fullBarParticles.Emitting = false;
139137
return GetNote();
140138
}
141139

@@ -149,6 +147,11 @@ private void DetermineComboMult()
149147
comboMult = _currentCombo / notesToIncreaseCombo + 1;
150148
}
151149

150+
public int GetCurrentCombo()
151+
{
152+
return _currentCombo;
153+
}
154+
152155
private void UpdateNotePlacementBar(int newValue)
153156
{
154157
notePlacementBar.Value = newValue;

scenes/BattleDirector/scripts/TextParticle.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ public override void _Ready()
99
Tween tween = GetTree().CreateTween();
1010
ZIndex = 2;
1111
Position += Vector2.Left * (GD.Randf() * 40 - 20);
12-
tween.SetTrans(Tween.TransitionType.Quad);
12+
tween.SetTrans(Tween.TransitionType.Elastic);
1313
tween.SetEase(Tween.EaseType.Out);
14-
tween.TweenProperty(this, "position", Position + Vector2.Up * 10, .5f);
15-
tween.TweenProperty(this, "position", Position + Vector2.Down * 20, .5f);
14+
tween.TweenProperty(this, "position", Position + Vector2.Up * 10, .25f).AsRelative();
15+
tween.TweenProperty(this, "position", Position + Vector2.Down * 20, .1f).AsRelative();
1616
tween.SetParallel();
17-
tween.TweenProperty(this, "modulate:a", 0, 1f);
17+
tween.SetTrans(Tween.TransitionType.Quad);
18+
tween.TweenProperty(this, "modulate:a", 0, .15f);
1819
tween.SetParallel(false);
1920
tween.TweenCallback(Callable.From(QueueFree));
2021
}

scenes/ChartViewport/ChartViewport.tscn

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[gd_scene load_steps=7 format=3 uid="uid://dfevfib11kou1"]
22

3-
[ext_resource type="Script" path="res://scenes/ChartViewport/ChartManager.cs" id="1_ruh2l"]
3+
[ext_resource type="Script" path="res://scenes/ChartViewport/scripts/ChartManager.cs" id="1_ruh2l"]
44
[ext_resource type="Texture2D" uid="uid://cp78odda2doab" path="res://scenes/ChartViewport/LoopMarker.png" id="2_q5cjc"]
5-
[ext_resource type="Script" path="res://scenes/ChartViewport/Loopable.cs" id="3_5u57h"]
5+
[ext_resource type="Script" path="res://scenes/ChartViewport/scripts/Loopable.cs" id="3_5u57h"]
66
[ext_resource type="PackedScene" uid="uid://bn8txx53xlguw" path="res://scenes/NoteManager/note_manager.tscn" id="4_fd5fw"]
77
[ext_resource type="Shader" path="res://scenes/ChartViewport/StarryNight.gdshader" id="5_kqrxg"]
88

@@ -30,6 +30,7 @@ position = Vector2(-50, 0)
3030
anchor_mode = 0
3131

3232
[node name="StarShader" type="ColorRect" parent="SubViewport"]
33+
z_index = -1
3334
material = SubResource("ShaderMaterial_5uw0y")
3435
offset_left = -60.0
3536
offset_right = 415.0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[gd_scene load_steps=2 format=3 uid="uid://bcf6vs4aqoxr5"]
2+
3+
[ext_resource type="Script" path="res://scenes/ChartViewport/scripts/HitParticles.cs" id="1_tr2t2"]
4+
5+
[node name="HitParticles" type="CPUParticles2D"]
6+
z_index = -1
7+
emitting = false
8+
amount = 1
9+
lifetime = 0.25
10+
speed_scale = 2.01
11+
explosiveness = 0.5
12+
spread = 180.0
13+
gravity = Vector2(0, 0)
14+
initial_velocity_min = 50.0
15+
initial_velocity_max = 200.0
16+
scale_amount_max = 2.0
17+
script = ExtResource("1_tr2t2")

scenes/ChartViewport/ChartManager.cs renamed to scenes/ChartViewport/scripts/ChartManager.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ private NoteArrow CreateNote(ArrowType arrow, Note note, int beat = 0)
114114
return newArrow;
115115
}
116116

117+
public void ComboText(string text, ArrowType arrow, int currentCombo)
118+
{
119+
TextParticle newText = new TextParticle();
120+
AddChild(newText);
121+
newText.Position = IH.Arrows[(int)arrow].Node.Position - newText.Size/2;
122+
IH.FeedbackEffect(arrow, text);
123+
newText.Text = text + $" {currentCombo}";
124+
}
125+
117126
public override void _ExitTree()
118127
{
119128
GD.Print("[DEBUG] Stopping tweens before exiting the scene...");
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using Godot;
3+
4+
public partial class HitParticles : CpuParticles2D
5+
{
6+
public void Emit(int particleAmount)
7+
{
8+
// Apply the particle amount and start emitting
9+
Amount = particleAmount;
10+
Emitting = true;
11+
12+
// Stop particles after a short delay using a Timer
13+
Timer timer = new Timer();
14+
timer.WaitTime = 0.25f; // Stop emitting after 0.5 seconds
15+
timer.OneShot = true;
16+
timer.Timeout += () =>
17+
{
18+
Emitting = false;
19+
timer.QueueFree(); // Clean up the timer
20+
};
21+
22+
AddChild(timer);
23+
timer.Start();
24+
}
25+
}

0 commit comments

Comments
 (0)