Skip to content

Commit 2c5311a

Browse files
committed
temporary changes, will fix later
1 parent 5e97038 commit 2c5311a

2 files changed

Lines changed: 32 additions & 14 deletions

File tree

Globals/Scribe.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ public partial class Scribe : Node
2727
director.Enemy.TakeDamage((int)timing);
2828
}
2929
),
30+
new Note(
31+
"PlayerDouble",
32+
null,
33+
2,
34+
(director, note, timing) =>
35+
{
36+
director.Enemy.TakeDamage((int)timing);
37+
}
38+
),
3039
};
3140

3241
public static readonly RelicTemplate[] RelicDictionary = new[]

scenes/CustomNotes/NoteQueue.cs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using FunkEngine;
34
using Godot;
45

56
public partial class NoteQueue : Node
@@ -10,51 +11,59 @@ public partial class NoteQueue : Node
1011
[Export]
1112
private Sprite2D _nextNote;
1213

13-
private Queue<string> _noteQueue = new Queue<string>();
14+
private Queue<Note> _noteQueue = new Queue<Note>();
1415
private Dictionary<string, Texture2D> _noteSprites = new Dictionary<string, Texture2D>();
1516

1617
public override void _Ready()
1718
{
18-
_noteSprites["single"] = GD.Load<Texture2D>(
19+
_noteSprites["PlayerBase"] = GD.Load<Texture2D>(
1920
"res://scenes/CustomNotes/assets/single_note.png"
2021
);
21-
_noteSprites["double"] = GD.Load<Texture2D>(
22+
_noteSprites["PlayerDouble"] = GD.Load<Texture2D>(
2223
"res://scenes/CustomNotes/assets/double_note.png"
2324
);
2425

2526
UpdateQueue();
2627
}
2728

28-
public void AddNoteToQueue(string noteType)
29+
public void LoadQueue(PlayerPuppet player)
30+
{
31+
for (int i = 0; i < player.Stats.CurNotes.Length; i++)
32+
{
33+
AddNoteToQueue(player.Stats.CurNotes[i]);
34+
}
35+
}
36+
37+
public void AddNoteToQueue(Note noteType)
2938
{
3039
_noteQueue.Enqueue(noteType);
3140
UpdateQueue();
3241
}
3342

3443
//returns current note, and removes it from the queue
35-
public string GetCurrentNote()
44+
public Note GetCurrentNote()
3645
{
3746
if (_noteQueue.Count > 0)
3847
{
39-
string currentNoteName = _noteQueue.Dequeue();
48+
Note currentNote = _noteQueue.Dequeue();
4049
UpdateQueue();
41-
return currentNoteName;
50+
return currentNote;
4251
}
4352
return null;
4453
}
4554

4655
private void UpdateQueue()
4756
{
48-
if (_noteQueue.Count > 0 && _noteSprites.ContainsKey(_noteQueue.Peek()))
49-
_currentNote.Texture = _noteSprites[_noteQueue.Peek()];
57+
if (_noteQueue.Count > 0 && _noteSprites.ContainsKey(_noteQueue.Peek().Name))
58+
_currentNote.Texture = _noteSprites[_noteQueue.Peek().Name];
5059
else
5160
_currentNote.Texture = null;
5261

5362
if (_noteQueue.Count > 1)
5463
{
55-
string[] notes = _noteQueue.ToArray();
56-
if (_noteSprites.ContainsKey(notes[1]))
57-
_nextNote.Texture = _noteSprites[notes[1]];
64+
Note[] notes = _noteQueue.ToArray();
65+
if (_noteSprites.ContainsKey(notes[1].Name))
66+
_nextNote.Texture = _noteSprites[notes[1].Name];
5867
else
5968
_nextNote.Texture = null;
6069
}
@@ -67,7 +76,7 @@ private void UpdateQueue()
6776
//Fisher-Yates shuffle from: https://stackoverflow.com/a/1262619
6877
public void ScrambleQueue()
6978
{
70-
List<string> tempList = new List<string>(_noteQueue);
79+
List<Note> tempList = new List<Note>(_noteQueue);
7180
Random rng = new Random();
7281

7382
int n = tempList.Count;
@@ -78,7 +87,7 @@ public void ScrambleQueue()
7887
(tempList[k], tempList[n]) = (tempList[n], tempList[k]);
7988
}
8089

81-
_noteQueue = new Queue<string>(tempList);
90+
_noteQueue = new Queue<Note>(tempList);
8291
}
8392

8493
//TODO: should work, in order to run in game use

0 commit comments

Comments
 (0)