diff --git a/.gitignore b/.gitignore index 161c6b19..a930fc00 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ .idea/.idea.Funk Engine/.idea/ + +*.DotSettings.user +export_presets.cfg \ No newline at end of file diff --git a/Audio/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav b/Audio/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav new file mode 100644 index 00000000..08fbc866 Binary files /dev/null and b/Audio/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav differ diff --git a/Audio/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav.import b/Audio/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav.import new file mode 100644 index 00000000..4a4ee318 --- /dev/null +++ b/Audio/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cq1c2vs11cp5e" +path="res://.godot/imported/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav-e288d05020bddeea68e6248ede74a475.sample" + +[deps] + +source_file="res://Audio/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav" +dest_files=["res://.godot/imported/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav-e288d05020bddeea68e6248ede74a475.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Audio/midi/florestan-subset.sf2 b/Audio/midi/florestan-subset.sf2 new file mode 100644 index 00000000..56a930ac Binary files /dev/null and b/Audio/midi/florestan-subset.sf2 differ diff --git a/Audio/midi/midiTest.mid b/Audio/midi/midiTest.mid new file mode 100644 index 00000000..1809c02a Binary files /dev/null and b/Audio/midi/midiTest.mid differ diff --git a/Audio/midi/midiTest2.mid b/Audio/midi/midiTest2.mid new file mode 100644 index 00000000..c657321a Binary files /dev/null and b/Audio/midi/midiTest2.mid differ diff --git a/Classes/MidiMaestro/MidiMaestro.cs b/Classes/MidiMaestro/MidiMaestro.cs new file mode 100644 index 00000000..295b5d6d --- /dev/null +++ b/Classes/MidiMaestro/MidiMaestro.cs @@ -0,0 +1,110 @@ +using System; +using System.Linq; +using FunkEngine; +using Godot; +using Melanchall.DryWetMidi.Core; +using Melanchall.DryWetMidi.Interaction; +using Melanchall.DryWetMidi.Multimedia; + +public partial class MidiMaestro : Resource +{ + private MidiFile _midiFile; + + //The four note rows that we care about + private midiNoteInfo[] _upNotes; + private midiNoteInfo[] _downNotes; + private midiNoteInfo[] _leftNotes; + private midiNoteInfo[] _rightNotes; + + private MidiFile strippedSong; + + private SongData songData; + + //The path relative to the Audio folder. Will change later + public MidiMaestro(string filePath) + { + if (!FileAccess.FileExists(filePath)) + { + GD.PrintErr("ERROR: Unable to load level Midi file: " + filePath); + } + + _midiFile = MidiFile.Read(filePath); + + //Strip out the notes from the midi file + foreach (var track in _midiFile.GetTrackChunks()) + { + string trackName = track.Events.OfType().FirstOrDefault()?.Text; + midiNoteInfo[] noteEvents = track + .GetNotes() + .Select(note => new midiNoteInfo(note, _midiFile.GetTempoMap())) + .ToArray(); + + switch (trackName) + { + case "Up": + _upNotes = noteEvents; + break; + case "Down": + _downNotes = noteEvents; + break; + case "Left": + _leftNotes = noteEvents; + break; + case "Right": + _rightNotes = noteEvents; + break; + } + } + + //Populate the song data + songData = new SongData + { + //TODO: Allow for changes in this data + Bpm = 120, + //Fudge the numbers a bit if we have a really short song + SongLength = + _midiFile.GetDuration().Seconds < 20 + ? 20 + : _midiFile.GetDuration().Seconds, + NumLoops = 1, + }; + } + + public midiNoteInfo[] GetNotes(ArrowType arrowType) + { + return arrowType switch + { + ArrowType.Up => _upNotes, + ArrowType.Down => _downNotes, + ArrowType.Left => _leftNotes, + ArrowType.Right => _rightNotes, + _ => throw new ArgumentOutOfRangeException(nameof(arrowType), arrowType, null), + }; + } + + public SongData GetSongData() + { + return songData; + } +} + +//A facade to wrap the midi notes. This is a simple class that wraps a Note object from the DryWetMidi library. +public class midiNoteInfo +{ + private readonly Melanchall.DryWetMidi.Interaction.Note _note; + private readonly TempoMap _tempoMap; + + public midiNoteInfo(Melanchall.DryWetMidi.Interaction.Note note, TempoMap tempoMap) + { + _note = note; + _tempoMap = tempoMap; + } + + public long GetStartTimeTicks() => _note.Time; + + public int GetStartTimeSeconds() => _note.TimeAs(_tempoMap).Seconds; + + public long GetEndTime() => _note.EndTime; + + public long GetDuration() => _note.Length; +} diff --git a/Classes/MidiMaestro/SongTemplate.cs b/Classes/MidiMaestro/SongTemplate.cs new file mode 100644 index 00000000..300ddea4 --- /dev/null +++ b/Classes/MidiMaestro/SongTemplate.cs @@ -0,0 +1,15 @@ +namespace FunkEngine.Classes.MidiMaestro; + +public partial class SongTemplate +{ + public string Name; + public string AudioLocation; + public string MIDILocation; + + public SongTemplate(string name = "", string audioLocation = "", string midiLocation = "") + { + Name = name; + AudioLocation = audioLocation; + MIDILocation = midiLocation; + } +} diff --git a/Classes/Notes/Note.cs b/Classes/Notes/Note.cs index 8795cf42..f382b128 100644 --- a/Classes/Notes/Note.cs +++ b/Classes/Notes/Note.cs @@ -11,6 +11,7 @@ public partial class Note : Resource public PuppetTemplate Owner; public string Name; private int _baseVal; + public float CostModifier { get; private set; } private Action NoteEffect; //TODO: Where/How to deal with timing. public string Tooltip; @@ -22,7 +23,8 @@ public Note( Texture2D texture = null, PuppetTemplate owner = null, int baseVal = 1, - Action noteEffect = null + Action noteEffect = null, + float costModifier = 1.0f ) { Name = name; @@ -38,6 +40,7 @@ public Note( _baseVal = baseVal; Texture = texture; Tooltip = tooltip; + CostModifier = costModifier; } public void OnHit(BattleDirector BD, Timing timing) @@ -49,7 +52,7 @@ public Note Clone() { //Eventually could look into something more robust, but for now shallow copy is preferable. //We only would want val and name to be copied by value - Note newNote = new Note(Name, Tooltip, Texture, Owner, _baseVal, NoteEffect); + Note newNote = new Note(Name, Tooltip, Texture, Owner, _baseVal, NoteEffect, CostModifier); return newNote; } } diff --git a/Classes/Notes/assets/heal_note.png b/Classes/Notes/assets/heal_note.png new file mode 100644 index 00000000..5fe43120 Binary files /dev/null and b/Classes/Notes/assets/heal_note.png differ diff --git a/Classes/Notes/assets/heal_note.png.import b/Classes/Notes/assets/heal_note.png.import new file mode 100644 index 00000000..22f3a997 --- /dev/null +++ b/Classes/Notes/assets/heal_note.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cdf3g3174du4r" +path="res://.godot/imported/heal_note.png-09ca289a296eee82d33c64101a4e593a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Classes/Notes/assets/heal_note.png" +dest_files=["res://.godot/imported/heal_note.png-09ca289a296eee82d33c64101a4e593a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Classes/Notes/assets/quarter_note.png b/Classes/Notes/assets/quarter_note.png new file mode 100644 index 00000000..a8cbd41b Binary files /dev/null and b/Classes/Notes/assets/quarter_note.png differ diff --git a/Classes/Notes/assets/quarter_note.png.import b/Classes/Notes/assets/quarter_note.png.import new file mode 100644 index 00000000..0729e611 --- /dev/null +++ b/Classes/Notes/assets/quarter_note.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://uksjoqp7p0gq" +path="res://.godot/imported/quarter_note.png-2b4c9985d99038807abfd63e553c2d6a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Classes/Notes/assets/quarter_note.png" +dest_files=["res://.godot/imported/quarter_note.png-2b4c9985d99038807abfd63e553c2d6a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Classes/Notes/assets/vampire_note.png b/Classes/Notes/assets/vampire_note.png new file mode 100644 index 00000000..d00b6a3f Binary files /dev/null and b/Classes/Notes/assets/vampire_note.png differ diff --git a/Classes/Notes/assets/vampire_note.png.import b/Classes/Notes/assets/vampire_note.png.import new file mode 100644 index 00000000..65be637e --- /dev/null +++ b/Classes/Notes/assets/vampire_note.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dg0lmu0pip4lr" +path="res://.godot/imported/vampire_note.png-4331f817a6feee1f1066a9e9f95934c8.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Classes/Notes/assets/vampire_note.png" +dest_files=["res://.godot/imported/vampire_note.png-4331f817a6feee1f1066a9e9f95934c8.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Funk Engine.csproj b/Funk Engine.csproj index f8d51ba9..0fb7dbfb 100644 --- a/Funk Engine.csproj +++ b/Funk Engine.csproj @@ -1,4 +1,4 @@ - + net6.0 net7.0 @@ -8,6 +8,7 @@ + diff --git a/Funk Engine.sln.DotSettings.user b/Funk Engine.sln.DotSettings.user deleted file mode 100644 index 6125b70c..00000000 --- a/Funk Engine.sln.DotSettings.user +++ /dev/null @@ -1,3 +0,0 @@ - - ForceIncluded - ForceIncluded \ No newline at end of file diff --git a/Globals/FunkEngineNameSpace.cs b/Globals/FunkEngineNameSpace.cs index 7d422ea6..9aa475ae 100644 --- a/Globals/FunkEngineNameSpace.cs +++ b/Globals/FunkEngineNameSpace.cs @@ -1,7 +1,24 @@ -using Godot; +using System; +using System.Linq; +using Godot; namespace FunkEngine; +public struct SongData +{ + public int Bpm; + public double SongLength; + public int NumLoops; +} + +public struct ArrowData +{ + public Color Color; + public string Key; + public NoteChecker Node; + public ArrowType Type; +} + public enum ArrowType { Up = 0, @@ -10,14 +27,6 @@ public enum ArrowType Right = 3, } -public enum BattleEffectTrigger -{ - NotePlaced, - NoteHit, - SelfNoteHit, - OnPickup, -} - public enum Timing { Miss = 0, @@ -27,27 +36,154 @@ public enum Timing Perfect = 4, } +public struct BattleConfig +{ + public Stages RoomType; + public MapGrid.Room BattleRoom; + public int TodoEnemyAndChart; + public SongData CurSong; +} + +public enum BattleEffectTrigger +{ + NotePlaced, + NoteHit, + SelfNoteHit, + OnPickup, +} + public enum Stages { Title, Battle, + Chest, + Boss, Quit, Map, + Controls, } -public struct SongData +public class MapGrid { - public int Bpm; - public double SongLength; - public int NumLoops; -} + private int[,] _map; + private Room[] _rooms; + private int _curIdx = 0; -public struct ArrowData -{ - public Color Color; - public string Key; - public NoteChecker Node; - public ArrowType Type; + public Room[] GetRooms() + { + return _rooms; + } + + public class Room + { + public Room(int idx, int x, int y) + { + Idx = idx; + X = x; + Y = y; + } + + public void SetType(Stages type) + { + Type = type; + } + + public void AddChild(int newIdx) + { + if (Children.Contains(newIdx)) + return; + Children = Children.Append(newIdx).ToArray(); + } + + public int Idx { get; private set; } + public int[] Children { get; private set; } = Array.Empty(); + public int X { get; private set; } + public int Y { get; private set; } + public Stages Type { get; private set; } + } + + public void InitMapGrid(int width, int height, int paths) + { + _curIdx = 0; + _rooms = Array.Empty(); + _map = new int[width, height]; //x,y + + int startX = (width / 2); + _rooms = _rooms.Append(new Room(_curIdx, startX, 0)).ToArray(); + _rooms[0].SetType(Stages.Battle); + _map[startX, 0] = _curIdx++; + + for (int i = 0; i < paths; i++) + { + GeneratePath_r(startX, 0, width, height); + } + CreateCommonChildren(width, height); + AddBossRoom(width, height); + } + + //Start at x, y, assume prev room exists. Picks new x pos within +/- 1, attaches recursively + private void GeneratePath_r(int x, int y, int width, int height) + { + int nextX = StageProducer.GlobalRng.RandiRange( + Math.Max(x - 1, 0), + Math.Min(x + 1, width - 1) + ); + if (_map[nextX, y + 1] == 0) + { + _rooms = _rooms.Append(new Room(_curIdx, nextX, y + 1)).ToArray(); + _map[nextX, y + 1] = _curIdx; + _rooms[_map[x, y]].AddChild(_curIdx++); + _rooms[^1].SetType(PickRoomType(x, y)); + } + else + { + _rooms[_map[x, y]].AddChild(_map[nextX, y + 1]); + } + if (y < height - 2) + { + GeneratePath_r(nextX, y + 1, width, height); + } + } + + private Stages PickRoomType(int x, int y) + { + if (y <= 2) + return Stages.Battle; + if (y % 3 == 0) + return Stages.Chest; + if (StageProducer.GlobalRng.Randf() < .1) + return Stages.Chest; + return Stages.Battle; + } + + //Asserts that if there is a room at the same x, but y+1 they are connected + private void CreateCommonChildren(int width, int height) + { + foreach (Room room in _rooms) + { + Vector2I curPos = new Vector2I(room.X, room.Y); + if (room.Y + 1 >= height) + continue; + if (_map[curPos.X, curPos.Y + 1] == 0) + continue; + GD.Print("Added child on same X."); + room.AddChild(_map[curPos.X, curPos.Y + 1]); + } + } + + //Adds a boss room at the end of rooms, all max height rooms connect to it. + private void AddBossRoom(int width, int height) + { + _rooms = _rooms.Append(new Room(_curIdx, width / 2, height)).ToArray(); + _rooms[_curIdx].SetType(Stages.Boss); + for (int i = 0; i < width; i++) //Attach all last rooms to a boss room + { + if (_map[i, height - 1] != 0) + { + _rooms[_map[i, height - 1]].AddChild(_curIdx); + } + } + } } public interface IBattleEvent diff --git a/Globals/Scribe.cs b/Globals/Scribe.cs index 45bc8588..e3e61322 100644 --- a/Globals/Scribe.cs +++ b/Globals/Scribe.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using FunkEngine; +using FunkEngine.Classes.MidiMaestro; using Godot; /** @@ -13,7 +14,7 @@ public partial class Scribe : Node new Note( "EnemyBase", "Basic enemy note, deals damage to player.", - GD.Load("res://scenes/BattleDirector/assets/Character1.png"), + null, null, 1, (director, note, timing) => @@ -45,6 +46,41 @@ public partial class Scribe : Node director.Enemy.TakeDamage(2 * (int)timing); } ), + new Note( + "PlayerHeal", + "Basic player note, heals player", + GD.Load("res://Classes/Notes/assets/heal_note.png"), + null, + 1, + (director, note, timing) => + { + director.Player.Heal((int)timing); + } + ), + new Note( + "PlayerVampire", + "Steals health from enemy", + GD.Load("res://Classes/Notes/assets/vampire_note.png"), + null, + 1, + (director, note, timing) => + { + director.Player.Heal((int)timing); + director.Enemy.TakeDamage((int)timing); + } + ), + new Note( + "PlayerQuarter", + "Basic note at a quarter of the cost", + GD.Load("res://Classes/Notes/assets/quarter_note.png"), + null, + 1, + (director, note, timing) => + { + director.Enemy.TakeDamage((int)timing); + }, + 0.25f + ), }; public static readonly RelicTemplate[] RelicDictionary = new[] @@ -104,4 +140,18 @@ public static RelicTemplate[] GetRandomRelics(RelicTemplate[] ownedRelics, int c } return availableRelics; } + + public static readonly SongTemplate[] SongDictionary = new[] + { + new SongTemplate( + "Song1", + "Audio/335571__magntron__gamemusic_120bpm.mp3", + "Audio/midi/midiTest.mid" + ), + new SongTemplate( + "Song2", + "Audio/620230__josefpres__dark-loops-220-octave-piano-with-efect-short-loop-60-bpm.wav", + "Audio/midi/midiTest2.mid" + ), + }; } diff --git a/Globals/StageProducer.cs b/Globals/StageProducer.cs index d304eaaa..21b49376 100644 --- a/Globals/StageProducer.cs +++ b/Globals/StageProducer.cs @@ -12,125 +12,19 @@ public partial class StageProducer : Node private ulong _lastRngState; private bool _isInitialized = false; - private Stages _curStage = Stages.Title; + private Stages _curStage = Stages.Title; //TODO: State Machine kinda deal? private Node _curScene; public static MapGrid.Room CurRoom { get; private set; } public static Vector2I MapSize { get; private set; } = new Vector2I(7, 6); //For now, make width an odd number public static MapGrid Map { get; } = new MapGrid(); + public static BattleConfig Config; + //Hold here to persist between changes //TODO: Allow for permanent changes and battle temporary stat changes. public static PlayerStats PlayerStats; - public class MapGrid - { - private int[,] _map; - private Room[] _rooms; - private int _curIdx = 0; - private int _curRoom = 0; - - public Room[] GetRooms() - { - return _rooms; - } - - public class Room - { - public Room(int idx, int x, int y) - { - Idx = idx; - X = x; - Y = y; - } - - public void SetType(string type) - { - Type = type; - } - - public void AddChild(int newIdx) - { - if (Children.Contains(newIdx)) - return; - Children = Children.Append(newIdx).ToArray(); - } - - public int Idx { get; private set; } - public int[] Children { get; private set; } = Array.Empty(); - public int X { get; private set; } - public int Y { get; private set; } - private string Type; - } - - public void InitMapGrid(int width, int height, int paths) - { - _curIdx = 0; - _rooms = Array.Empty(); - _map = new int[width, height]; //x,y - - int startX = (width / 2); - _rooms = _rooms.Append(new Room(_curIdx, startX, 0)).ToArray(); - _map[startX, 0] = _curIdx++; - - for (int i = 0; i < paths; i++) - { - GeneratePath_r(startX, 0, width, height); - } - CreateCommonChildren(width, height); - AddBossRoom(width, height); - } - - //Start at x, y, assume prev room exists. Picks new x pos within +/- 1, attaches recursively - private void GeneratePath_r(int x, int y, int width, int height) - { - int nextX = GlobalRng.RandiRange(Math.Max(x - 1, 0), Math.Min(x + 1, width - 1)); - if (_map[nextX, y + 1] == 0) - { - _rooms = _rooms.Append(new Room(_curIdx, nextX, y + 1)).ToArray(); - _map[nextX, y + 1] = _curIdx; - _rooms[_map[x, y]].AddChild(_curIdx++); - } - else - { - _rooms[_map[x, y]].AddChild(_map[nextX, y + 1]); - } - if (y < height - 2) - { - GeneratePath_r(nextX, y + 1, width, height); - } - } - - //Asserts that if there is a room at the same x, but y+1 they are connected - private void CreateCommonChildren(int width, int height) - { - foreach (Room room in _rooms) - { - Vector2I curPos = new Vector2I(room.X, room.Y); - if (room.Y + 1 >= height) - continue; - if (_map[curPos.X, curPos.Y + 1] == 0) - continue; - GD.Print("Added child on same X."); - room.AddChild(_map[curPos.X, curPos.Y + 1]); - } - } - - //Adds a boss room at the end of rooms, all max height rooms connect to it. - private void AddBossRoom(int width, int height) - { - _rooms = _rooms.Append(new Room(_curIdx, width / 2, height)).ToArray(); - _rooms[_curIdx].SetType("Boss"); - for (int i = 0; i < width; i++) //Attach all last rooms to a boss room - { - if (_map[i, height - 1] != 0) - { - _rooms[_map[i, height - 1]].AddChild(_curIdx); - } - } - } - } - public void StartGame() { Map.InitMapGrid(MapSize.X, MapSize.Y, 3); @@ -142,13 +36,17 @@ public void StartGame() _isInitialized = true; } + public static void ChangeCurRoom(MapGrid.Room room) + { + CurRoom = room; + } + public void TransitionFromRoom(int nextRoomIdx) { - //CurRoom = Map.GetRooms()[nextRoomIdx]; - TransitionStage(Stages.Battle); + TransitionStage(Map.GetRooms()[nextRoomIdx].Type, nextRoomIdx); } - public void TransitionStage(Stages nextStage) + public void TransitionStage(Stages nextStage, int nextRoomIdx = -1) { GD.Print(GetTree().CurrentScene); switch (nextStage) @@ -158,8 +56,16 @@ public void TransitionStage(Stages nextStage) GetTree().ChangeSceneToFile("res://scenes/SceneTransitions/TitleScreen.tscn"); break; case Stages.Battle: + Config = MakeConfig(nextStage, nextRoomIdx); GetTree().ChangeSceneToFile("res://scenes/BattleDirector/test_battle_scene.tscn"); break; + case Stages.Controls: + GetTree().ChangeSceneToFile("res://scenes/Remapping/Remap.tscn"); + break; + case Stages.Chest: + Config = MakeConfig(nextStage, nextRoomIdx); + GetTree().ChangeSceneToFile("res://scenes/ChestScene/ChestScene.tscn"); + break; case Stages.Map: GetTree().ChangeSceneToFile("res://scenes/Maps/cartographer.tscn"); if (!_isInitialized) @@ -178,4 +84,22 @@ public void TransitionStage(Stages nextStage) _curStage = nextStage; } + + private BattleConfig MakeConfig(Stages nextRoom, int nextRoomIdx) + { + BattleConfig result = new BattleConfig(); + result.BattleRoom = Map.GetRooms()[nextRoomIdx]; + result.RoomType = nextRoom; + if (nextRoom is Stages.Battle or Stages.Boss) + { + result.CurSong = new SongData + { + Bpm = 120, + SongLength = -1, + NumLoops = 5, + }; + } + + return result; + } } diff --git a/Globals/TimeKeeper.cs b/Globals/TimeKeeper.cs index 7f09ddff..6db364ef 100644 --- a/Globals/TimeKeeper.cs +++ b/Globals/TimeKeeper.cs @@ -7,4 +7,9 @@ public partial class TimeKeeper : Node public static float ChartLength; public static float LoopLength; public static float Bpm; + + public static double PosMod(double i, double mod) + { + return (i % mod + mod) % mod; + } } diff --git a/README.md b/README.md index 65055df1..973b1526 100644 --- a/README.md +++ b/README.md @@ -15,5 +15,6 @@ Current team members include: #### Attributions: First Song: gameMusic by Magntron - freesound.org +Input buttons by Nicolae (Xelu) Berbece diff --git a/project.godot b/project.godot index 94e0cab0..86d2eb12 100644 --- a/project.godot +++ b/project.godot @@ -10,10 +10,10 @@ config_version=5 [application] -config/name="Funk Engine" +config/name="ProjectFunkEngine" run/main_scene="res://scenes/SceneTransitions/TitleScreen.tscn" config/features=PackedStringArray("4.3", "C#", "Forward Plus") -config/icon="res://icon.svg" +config/icon="res://scenes/BattleDirector/assets/Character1.png" [autoload] @@ -32,30 +32,42 @@ window/stretch/scale_mode="integer" project/assembly_name="Funk Engine" +[game] + +input_scheme="QWERT" + [input] arrowUp={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) ] } arrowDown={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) ] } arrowLeft={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null) ] } arrowRight={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":86,"key_label":0,"unicode":118,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null) ] } Pause={ diff --git a/scenes/BattleDirector/NotePlacementBar.tscn b/scenes/BattleDirector/NotePlacementBar.tscn index 7f1133c2..9e3ee4f9 100644 --- a/scenes/BattleDirector/NotePlacementBar.tscn +++ b/scenes/BattleDirector/NotePlacementBar.tscn @@ -10,16 +10,16 @@ colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1) [sub_resource type="GradientTexture2D" id="GradientTexture2D_hhds4"] gradient = SubResource("Gradient_0u6yv") -width = 26 +width = 34 height = 100 [sub_resource type="Gradient" id="Gradient_xvck1"] -offsets = PackedFloat32Array(0, 0.485915, 0.739437, 1) -colors = PackedColorArray(0, 1, 0, 1, 0.68, 0, 0.272, 1, 0, 0.64, 0.608, 1, 0.4, 0, 0, 1) +offsets = PackedFloat32Array(0, 0.373239, 0.690141, 1) +colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0.4, 1, 0, 1, 0.95, 1, 1, 0, 0, 1) [sub_resource type="GradientTexture2D" id="GradientTexture2D_0bqho"] gradient = SubResource("Gradient_xvck1") -width = 24 +width = 32 height = 98 fill_to = Vector2(0, 1) @@ -33,25 +33,27 @@ grow_vertical = 2 script = ExtResource("1_456es") notePlacementBar = NodePath("ProgressBar") currentComboMultText = NodePath("TextEdit") -_currentNote = NodePath("NoteQueueSprite/CurrentNote") -_nextNote = NodePath("NoteQueueSprite/NextNote") +_currentNote = NodePath("NoteQueueSprite/NextNote") +_nextNote = NodePath("NoteQueueSprite/CurrentNote") [node name="ProgressBar" type="TextureProgressBar" parent="."] layout_mode = 0 -offset_right = 26.0 -offset_bottom = 100.0 +offset_left = 41.0 +offset_top = 33.0 +offset_right = 75.0 +offset_bottom = 133.0 fill_mode = 3 texture_under = SubResource("GradientTexture2D_hhds4") texture_progress = SubResource("GradientTexture2D_0bqho") texture_progress_offset = Vector2(1, 1) [node name="TextEdit" type="TextEdit" parent="."] +z_as_relative = false layout_mode = 0 -offset_top = -41.0 -offset_right = 50.0 -offset_bottom = -6.0 +offset_right = 80.0 +offset_bottom = 35.0 mouse_filter = 2 -text = "x1" +text = " x1" context_menu_enabled = false shortcut_keys_enabled = false selecting_enabled = false @@ -61,13 +63,16 @@ virtual_keyboard_enabled = false middle_mouse_paste_enabled = false [node name="NoteQueueSprite" type="Sprite2D" parent="."] -position = Vector2(84, -24) +position = Vector2(23, 66) +rotation = -1.5708 texture = ExtResource("2_3tw16") -[node name="CurrentNote" type="Sprite2D" parent="NoteQueueSprite"] -position = Vector2(-14, -1) +[node name="NextNote" type="Sprite2D" parent="NoteQueueSprite"] +position = Vector2(-16, 0) +rotation = 1.5708 texture = ExtResource("3_6ylx6") -[node name="NextNote" type="Sprite2D" parent="NoteQueueSprite"] -position = Vector2(16, -2) +[node name="CurrentNote" type="Sprite2D" parent="NoteQueueSprite"] +position = Vector2(16, 0) +rotation = 1.5708 texture = ExtResource("4_6w8ha") diff --git a/scenes/BattleDirector/assets/BattleFrame1.png b/scenes/BattleDirector/assets/BattleFrame1.png new file mode 100644 index 00000000..223cc97d Binary files /dev/null and b/scenes/BattleDirector/assets/BattleFrame1.png differ diff --git a/scenes/BattleDirector/assets/BattleFrame1.png.import b/scenes/BattleDirector/assets/BattleFrame1.png.import new file mode 100644 index 00000000..2e4b1b49 --- /dev/null +++ b/scenes/BattleDirector/assets/BattleFrame1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dbjotl0v1ymia" +path="res://.godot/imported/BattleFrame1.png-09281473fcee09b42b1810f8f32b75f4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/BattleDirector/assets/BattleFrame1.png" +dest_files=["res://.godot/imported/BattleFrame1.png-09281473fcee09b42b1810f8f32b75f4.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/BattleDirector/assets/CoolBG.jpg b/scenes/BattleDirector/assets/CoolBG.jpg deleted file mode 100644 index 5848378a..00000000 Binary files a/scenes/BattleDirector/assets/CoolBG.jpg and /dev/null differ diff --git a/scenes/BattleDirector/assets/bgupdate.png b/scenes/BattleDirector/assets/bgupdate.png new file mode 100644 index 00000000..68b7ee08 Binary files /dev/null and b/scenes/BattleDirector/assets/bgupdate.png differ diff --git a/scenes/BattleDirector/assets/bgupdate.png.import b/scenes/BattleDirector/assets/bgupdate.png.import new file mode 100644 index 00000000..905115ed --- /dev/null +++ b/scenes/BattleDirector/assets/bgupdate.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://qhwve7fik4do" +path="res://.godot/imported/bgupdate.png-7e94b2cdf31dd024c5ed51b6fbe048af.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/BattleDirector/assets/bgupdate.png" +dest_files=["res://.godot/imported/bgupdate.png-7e94b2cdf31dd024c5ed51b6fbe048af.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/BattleDirector/assets/temp_note_queue.png b/scenes/BattleDirector/assets/temp_note_queue.png index c6a556d0..8ce76dec 100644 Binary files a/scenes/BattleDirector/assets/temp_note_queue.png and b/scenes/BattleDirector/assets/temp_note_queue.png differ diff --git a/scenes/BattleDirector/scripts/BattleDirector.cs b/scenes/BattleDirector/scripts/BattleDirector.cs index 9a0822c1..bde2fff5 100644 --- a/scenes/BattleDirector/scripts/BattleDirector.cs +++ b/scenes/BattleDirector/scripts/BattleDirector.cs @@ -32,8 +32,6 @@ public partial class BattleDirector : Node2D private SongData _curSong; - private bool _battleEnd; - #endregion #region Note Handling @@ -63,26 +61,25 @@ public PuppetTemplate GetTarget(Note note) public override void _Ready() { //TODO: Should come from transition into battle - _curSong = new SongData + _curSong = StageProducer.Config.CurSong; + if (_curSong.SongLength <= 0) { - Bpm = 120, - SongLength = Audio.Stream.GetLength(), - NumLoops = 5, - }; + _curSong.SongLength = Audio.Stream.GetLength(); + } TimeKeeper.Bpm = _curSong.Bpm; - Player = new PlayerPuppet(); + Player = GD.Load("res://scenes/Puppets/PlayerPuppet.tscn") + .Instantiate(); AddChild(Player); Player.Defeated += CheckBattleStatus; EventizeRelics(); NotePlacementBar.Setup(StageProducer.PlayerStats); //TODO: Refine - Enemy = new PuppetTemplate(); - Enemy.SetPosition(new Vector2(400, 0)); + Enemy = GD.Load("res://scenes/Puppets/Enemies/Boss1.tscn") + .Instantiate(); AddChild(Enemy); Enemy.Defeated += CheckBattleStatus; - Enemy.Init(GD.Load("res://scenes/BattleDirector/assets/Enemy1.png"), "Enemy"); //TODO: This is a temporary measure Button startButton = new Button(); @@ -105,7 +102,6 @@ private void Begin() CD.TimedInput += OnTimedInput; //TODO: Make enemies, can put this in an enemy subclass - Enemy.Sprite.Scale *= 2; var enemTween = CreateTween(); enemTween.TweenProperty(Enemy.Sprite, "position", Vector2.Down * 5, 1f).AsRelative(); enemTween.TweenProperty(Enemy.Sprite, "position", Vector2.Up * 5, 1f).AsRelative(); @@ -120,12 +116,16 @@ private void Begin() Audio.Play(); } + private void EndBattle() + { + StageProducer.ChangeCurRoom(StageProducer.Config.BattleRoom); + GetNode("/root/StageProducer").TransitionStage(Stages.Map); + } + public override void _Process(double delta) { TimeKeeper.CurrentTime = Audio.GetPlaybackPosition(); CD.CheckMiss(); - if (_battleEnd) - GetNode("/root/StageProducer").TransitionStage(Stages.Map); } #endregion @@ -138,24 +138,9 @@ public override void _UnhandledInput(InputEvent @event) { if (eventKey.Keycode == Key.Key0) { - //DebugKillEnemy(); + DebugKillEnemy(); } } - - if (@event.IsActionPressed("Pause")) - { - var pauseMenu = GD.Load("res://scenes/UI/Pause.tscn"); - GetNode("UILayer").AddChild(pauseMenu.Instantiate()); - GetTree().Paused = true; - } - if (@event.IsActionPressed("Inventory")) - { - var invenMenu = GD.Load("res://scenes/UI/inventory.tscn") - .Instantiate(); - GetNode("UILayer").AddChild(invenMenu); - invenMenu.Display(Player.Stats); - GetTree().Paused = true; - } } private void OnNotePressed(ArrowType type) @@ -214,6 +199,7 @@ private void CheckBattleStatus(PuppetTemplate puppet) if (puppet == Player) { GD.Print("Player is Dead"); + Audio.StreamPaused = true; GetNode("/root/StageProducer").TransitionStage(Stages.Title); return; } @@ -221,19 +207,15 @@ private void CheckBattleStatus(PuppetTemplate puppet) //will have to adjust this to account for when we have multiple enemies at once if (puppet == Enemy) { + Audio.StreamPaused = true; GD.Print("Enemy is dead"); ShowRewardSelection(3); - _battleEnd = true; } } private void ShowRewardSelection(int amount) { - var rewardUI = GD.Load("res://scenes/UI/RewardSelectionUI.tscn") - .Instantiate(); - AddChild(rewardUI); - rewardUI.Initialize(Player.Stats, amount); - GetTree().Paused = true; + RewardSelect.CreateSelection(this, Player.Stats, amount).Selected += EndBattle; } #endregion diff --git a/scenes/BattleDirector/scripts/Conductor.cs b/scenes/BattleDirector/scripts/Conductor.cs index 55ce9f50..8113bdca 100644 --- a/scenes/BattleDirector/scripts/Conductor.cs +++ b/scenes/BattleDirector/scripts/Conductor.cs @@ -6,6 +6,7 @@ public partial class Conductor : Node { [Export] private ChartManager CM; + public MidiMaestro MM; public delegate void TimedInputHandler(Note note, ArrowType type, int beat, double beatDif); public event TimedInputHandler TimedInput; @@ -63,6 +64,11 @@ public bool AddNoteToLane(ArrowType type, int beat, Note note, bool isActive = t return true; } + public override void _Ready() + { + MM = new MidiMaestro("Audio/midi/midiTest2.mid"); + } + public void Prep() //TODO: Streamline battle initialization { _laneData = new NoteArrow[][] @@ -78,7 +84,40 @@ public void Prep() //TODO: Streamline battle initialization private void AddExampleNotes() { GD.Print(CM.BeatsPerLoop); - for (int i = 1; i < 15; i++) + foreach (midiNoteInfo mNote in MM.GetNotes(ArrowType.Up)) + { + AddNoteToLane( + ArrowType.Up, + (int)(mNote.GetStartTimeSeconds() / (60 / (double)TimeKeeper.Bpm)), + Scribe.NoteDictionary[0] + ); + } + foreach (midiNoteInfo mNote in MM.GetNotes(ArrowType.Down)) + { + AddNoteToLane( + ArrowType.Down, + (int)(mNote.GetStartTimeSeconds() / (60 / (double)TimeKeeper.Bpm)), + Scribe.NoteDictionary[0] + ); + } + foreach (midiNoteInfo mNote in MM.GetNotes(ArrowType.Right)) + { + AddNoteToLane( + ArrowType.Right, + (int)(mNote.GetStartTimeSeconds() / (60 / (double)TimeKeeper.Bpm)), + Scribe.NoteDictionary[0] + ); + } + foreach (midiNoteInfo mNote in MM.GetNotes(ArrowType.Left)) + { + AddNoteToLane( + ArrowType.Left, + (int)(mNote.GetStartTimeSeconds() / (60 / (double)TimeKeeper.Bpm)), + Scribe.NoteDictionary[0] + ); + } + + /*for (int i = 1; i < 15; i++) { AddNoteToLane(ArrowType.Up, i * 4, Scribe.NoteDictionary[0]); } @@ -96,7 +135,7 @@ private void AddExampleNotes() for (int i = 0; i < 3; i++) { AddNoteToLane(ArrowType.Down, 8 * i + 16, Scribe.NoteDictionary[0]); - } + }*/ } //Check all lanes for misses from missed inputs diff --git a/scenes/BattleDirector/scripts/NotePlacementBar.cs b/scenes/BattleDirector/scripts/NotePlacementBar.cs index 4beb175e..6baf765f 100644 --- a/scenes/BattleDirector/scripts/NotePlacementBar.cs +++ b/scenes/BattleDirector/scripts/NotePlacementBar.cs @@ -117,7 +117,7 @@ public void HitNote() { _currentCombo++; DetermineComboMult(); - _currentBarValue += comboMult; + _currentBarValue = Math.Min(_currentBarValue + comboMult, MaxValue); UpdateNotePlacementBar(_currentBarValue); UpdateComboMultText(); } @@ -133,7 +133,8 @@ public void MissNote() // Placing a note resets the note placement bar public Note PlacedNote() { - _currentBarValue = 0; + _currentBarValue -= (int)(_currentNoteInstance.CostModifier * MaxValue); + UpdateNotePlacementBar(_currentBarValue); return GetNote(); } @@ -155,6 +156,6 @@ private void UpdateNotePlacementBar(int newValue) private void UpdateComboMultText() { - currentComboMultText.Text = $"x{comboMult.ToString()}"; + currentComboMultText.Text = $" x{comboMult.ToString()}"; } } diff --git a/scenes/BattleDirector/scripts/TextParticle.cs b/scenes/BattleDirector/scripts/TextParticle.cs index 905c93a2..2931ae01 100644 --- a/scenes/BattleDirector/scripts/TextParticle.cs +++ b/scenes/BattleDirector/scripts/TextParticle.cs @@ -7,6 +7,7 @@ public partial class TextParticle : Label public override void _Ready() { Tween tween = GetTree().CreateTween(); + ZIndex = 2; Position += Vector2.Left * (GD.Randf() * 40 - 20); tween.SetTrans(Tween.TransitionType.Quad); tween.SetEase(Tween.EaseType.Out); diff --git a/scenes/BattleDirector/test_battle_scene.tscn b/scenes/BattleDirector/test_battle_scene.tscn index b01d68d6..e0b58697 100644 --- a/scenes/BattleDirector/test_battle_scene.tscn +++ b/scenes/BattleDirector/test_battle_scene.tscn @@ -1,12 +1,23 @@ -[gd_scene load_steps=7 format=3 uid="uid://b0mrgr7h0ty1y"] +[gd_scene load_steps=11 format=3 uid="uid://b0mrgr7h0ty1y"] [ext_resource type="Script" path="res://scenes/BattleDirector/scripts/BattleDirector.cs" id="1_cwqqr"] [ext_resource type="PackedScene" uid="uid://dfevfib11kou1" path="res://scenes/ChartViewport/ChartViewport.tscn" id="2_cupb3"] [ext_resource type="Script" path="res://scenes/BattleDirector/scripts/Conductor.cs" id="2_pcp76"] -[ext_resource type="Texture2D" uid="uid://ci0g72j8q4ec2" path="res://scenes/BattleDirector/assets/CoolBG.jpg" id="4_13o87"] +[ext_resource type="Script" path="res://scenes/UI/scripts/MenuModule.cs" id="3_8hff6"] +[ext_resource type="Texture2D" uid="uid://qhwve7fik4do" path="res://scenes/BattleDirector/assets/bgupdate.png" id="4_13o87"] +[ext_resource type="Texture2D" uid="uid://dbjotl0v1ymia" path="res://scenes/BattleDirector/assets/BattleFrame1.png" id="6_0ak0g"] [ext_resource type="PackedScene" uid="uid://duhiilcv4tat3" path="res://scenes/BattleDirector/NotePlacementBar.tscn" id="7_3ko4g"] [ext_resource type="AudioStream" uid="uid://cv6lqjj6lu36h" path="res://Audio/335571__magntron__gamemusic_120bpm.mp3" id="8_caqms"] +[sub_resource type="Gradient" id="Gradient_8uy3a"] +offsets = PackedFloat32Array(0, 0.766234, 1) +colors = PackedColorArray(0.0823529, 0, 0.0784314, 1, 0.305882, 0.247059, 0.321569, 1, 0.27451, 0.243137, 0.403922, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_bajwn"] +gradient = SubResource("Gradient_8uy3a") +fill_from = Vector2(1, 0) +fill_to = Vector2(0.738532, 1) + [node name="ProtoBattleDirector" type="Node2D" node_paths=PackedStringArray("CM", "NotePlacementBar", "CD", "Audio")] process_mode = 1 script = ExtResource("1_cwqqr") @@ -20,6 +31,7 @@ metadata/_edit_lock_ = true stream = ExtResource("8_caqms") [node name="UILayer" type="CanvasLayer" parent="."] +script = ExtResource("3_8hff6") [node name="Conductor" type="Node" parent="." node_paths=PackedStringArray("CM")] script = ExtResource("2_pcp76") @@ -27,28 +39,30 @@ CM = NodePath("../SubViewport") [node name="SubViewport" parent="." instance=ExtResource("2_cupb3")] offset_left = 80.0 -offset_top = 160.0 +offset_top = 180.0 offset_right = 560.0 offset_bottom = 360.0 -[node name="ColorRect" type="TextureRect" parent="."] +[node name="NotePlacementBar" parent="." instance=ExtResource("7_3ko4g")] +offset_top = 183.0 +offset_bottom = 183.0 + +[node name="NPBBacking" type="TextureRect" parent="NotePlacementBar"] z_index = -1 -offset_right = 640.0 -offset_bottom = 360.0 -texture = ExtResource("4_13o87") +layout_mode = 0 +offset_right = 81.0 +offset_bottom = 175.0 +texture = SubResource("GradientTexture2D_bajwn") -[node name="ColorRect2" type="ColorRect" parent="."] -self_modulate = Color(0.36, 0.36, 0.36, 0.780392) +[node name="BackGround" type="TextureRect" parent="."] z_index = -1 -offset_left = -70.0 -offset_top = 160.0 -offset_right = 673.0 -offset_bottom = 360.0 -color = Color(0.165656, 0.165656, 0.165656, 1) +offset_right = 640.0 +offset_bottom = 178.0 +texture = ExtResource("4_13o87") -[node name="NotePlacementBar" parent="." instance=ExtResource("7_3ko4g")] +[node name="BattleFrame" type="TextureRect" parent="."] z_index = 1 -offset_left = 16.0 -offset_top = 164.0 -offset_right = 16.0 -offset_bottom = 164.0 +offset_top = 178.0 +offset_right = 640.0 +offset_bottom = 360.0 +texture = ExtResource("6_0ak0g") diff --git a/scenes/ChartViewport/ChartManager.cs b/scenes/ChartViewport/ChartManager.cs index 24e1bd12..9b0baa0e 100644 --- a/scenes/ChartViewport/ChartManager.cs +++ b/scenes/ChartViewport/ChartManager.cs @@ -25,7 +25,8 @@ public partial class ChartManager : SubViewportContainer public delegate void NoteReleasedEventHandler(ArrowType arrowType); //Arbitrary vars, play with these - private double ChartLength = 5000; //Might move this to be song specific? + //Might move this to be song specific? For now, should never go below ~2000, else visual break because there isn't enough room to loop. + private double ChartLength = 5000; private double _loopLen; //secs public int BeatsPerLoop; @@ -48,7 +49,6 @@ public void PrepChart(SongData songData) TimeKeeper.ChartLength = (float)ChartLength; TimeKeeper.Bpm = songData.Bpm; - InitBackgrounds(); _arrowGroup = ChartLoopables.GetNode("ArrowGroup"); IH.Connect(nameof(InputHandler.NotePressed), new Callable(this, nameof(OnNotePressed))); @@ -74,21 +74,6 @@ public void PrepChart(SongData songData) tween.SetLoops().Play(); } - private void InitBackgrounds() - { - int i = 0; - foreach (Node child in ChartLoopables.GetChildren()) - { - if (child is not Loopable) - continue; - Loopable loopable = (Loopable)child; - loopable.Position = Vector2.Zero; - loopable.SetSize(new Vector2((float)ChartLength / 2 + 1, Size.Y)); - loopable.Bounds = (float)ChartLength / 2 * i; - i++; - } - } - private void TweenArrows(Vector2 scale) { foreach (var node in _arrowGroup.GetChildren()) @@ -105,22 +90,23 @@ public NoteArrow AddArrowToLane( Color colorOverride = default ) { - var newNote = CreateNote(type, beat); //TODO: Notes on track have unqiue visuals - var loopArrow = CreateNote(type, beat + BeatsPerLoop); //Create a dummy arrow for looping visuals + var newNote = CreateNote(type, note, beat); //TODO: Notes on track have unqiue visuals + var loopArrow = CreateNote(type, note, beat + BeatsPerLoop); //Create a dummy arrow for looping visuals if (colorOverride != default) { - newNote.Modulate = colorOverride; - loopArrow.Modulate = colorOverride; + newNote.SelfModulate = colorOverride; + loopArrow.SelfModulate = colorOverride; } newNote.NoteRef = note; return newNote; } - private NoteArrow CreateNote(ArrowType arrow, int beat = 0) + private NoteArrow CreateNote(ArrowType arrow, Note note, int beat = 0) { var noteScene = ResourceLoader.Load("res://scenes/NoteManager/note.tscn"); NoteArrow newArrow = noteScene.Instantiate(); - newArrow.Init(IH.Arrows[(int)arrow], beat); + newArrow.Init(IH.Arrows[(int)arrow], beat, note); + newArrow.OutlineSprite.Modulate = IH.Arrows[(int)arrow].Color; _arrowGroup.AddChild(newArrow); newArrow.Bounds = (float)((double)beat / BeatsPerLoop * (ChartLength / 2)); diff --git a/scenes/ChartViewport/ChartViewport.tscn b/scenes/ChartViewport/ChartViewport.tscn index f6f9fb6a..8cfc9b5d 100644 --- a/scenes/ChartViewport/ChartViewport.tscn +++ b/scenes/ChartViewport/ChartViewport.tscn @@ -1,50 +1,51 @@ -[gd_scene load_steps=5 format=3 uid="uid://dfevfib11kou1"] +[gd_scene load_steps=7 format=3 uid="uid://dfevfib11kou1"] -[ext_resource type="Texture2D" uid="uid://b0tvsewgnf2x7" path="res://icon.svg" id="1_0wnka"] [ext_resource type="Script" path="res://scenes/ChartViewport/ChartManager.cs" id="1_ruh2l"] +[ext_resource type="Texture2D" uid="uid://cp78odda2doab" path="res://scenes/ChartViewport/LoopMarker.png" id="2_q5cjc"] [ext_resource type="Script" path="res://scenes/ChartViewport/Loopable.cs" id="3_5u57h"] [ext_resource type="PackedScene" uid="uid://bn8txx53xlguw" path="res://scenes/NoteManager/note_manager.tscn" id="4_fd5fw"] +[ext_resource type="Shader" path="res://scenes/ChartViewport/StarryNight.gdshader" id="5_kqrxg"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_5uw0y"] +shader = ExtResource("5_kqrxg") +shader_parameter/bg_top_color = Vector4(0.18, 0.08, 0.12, 0) +shader_parameter/bg_bottom_color = Vector4(0.028, 0.008, 0.184, 0) +shader_parameter/gradient_ratio = 1.0 +shader_parameter/time_scale = 1.0 [node name="VPContainer" type="SubViewportContainer" node_paths=PackedStringArray("IH", "ChartLoopables")] offset_right = 480.0 -offset_bottom = 200.0 +offset_bottom = 180.0 script = ExtResource("1_ruh2l") IH = NodePath("SubViewport/noteManager") ChartLoopables = NodePath("SubViewport/ChartLoopables") [node name="SubViewport" type="SubViewport" parent="."] handle_input_locally = false -size = Vector2i(480, 200) +size = Vector2i(480, 180) render_target_update_mode = 4 -[node name="ColorFill" type="ColorRect" parent="SubViewport"] -z_index = -2 -offset_left = -30.0 -offset_right = 610.0 -offset_bottom = 360.0 -color = Color(0.258824, 0.290196, 0.392157, 1) - [node name="Camera2D" type="Camera2D" parent="SubViewport"] -position = Vector2(-25, 0) +position = Vector2(-50, 0) anchor_mode = 0 +[node name="StarShader" type="ColorRect" parent="SubViewport"] +material = SubResource("ShaderMaterial_5uw0y") +offset_left = -60.0 +offset_right = 415.0 +offset_bottom = 177.0 +scale = Vector2(2.18, 2.18) +color = Color(0, 0, 0, 1) + [node name="ChartLoopables" type="CanvasGroup" parent="SubViewport"] unique_name_in_owner = true [node name="ArrowGroup" type="Node" parent="SubViewport/ChartLoopables"] -[node name="ChartBG2" type="TextureRect" parent="SubViewport/ChartLoopables"] -modulate = Color(2, 2, 2, 1) -offset_right = 701.0 -offset_bottom = 300.0 -texture = ExtResource("1_0wnka") -script = ExtResource("3_5u57h") - -[node name="ChartBG1" type="TextureRect" parent="SubViewport/ChartLoopables"] -modulate = Color(2, 2, 2, 1) -offset_right = 701.0 -offset_bottom = 300.0 -texture = ExtResource("1_0wnka") +[node name="LoopMarker" type="Sprite2D" parent="SubViewport/ChartLoopables"] +position = Vector2(0, 90) +texture = ExtResource("2_q5cjc") script = ExtResource("3_5u57h") +LoopOffset = 0.0 [node name="noteManager" parent="SubViewport" instance=ExtResource("4_fd5fw")] diff --git a/scenes/ChartViewport/LoopMarker.png b/scenes/ChartViewport/LoopMarker.png new file mode 100644 index 00000000..0879972d Binary files /dev/null and b/scenes/ChartViewport/LoopMarker.png differ diff --git a/scenes/ChartViewport/LoopMarker.png.import b/scenes/ChartViewport/LoopMarker.png.import new file mode 100644 index 00000000..dd4e29e8 --- /dev/null +++ b/scenes/ChartViewport/LoopMarker.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cp78odda2doab" +path="res://.godot/imported/LoopMarker.png-01682285489df860e67dba1278ff087a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/ChartViewport/LoopMarker.png" +dest_files=["res://.godot/imported/LoopMarker.png-01682285489df860e67dba1278ff087a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/ChartViewport/Loopable.cs b/scenes/ChartViewport/Loopable.cs index 45e3487e..70f38e33 100644 --- a/scenes/ChartViewport/Loopable.cs +++ b/scenes/ChartViewport/Loopable.cs @@ -5,22 +5,24 @@ * @class Loopable * @brief A general class fo textures on the chart which should have a position at which point they loop. WIP */ -public partial class Loopable : TextureRect +public partial class Loopable : Sprite2D { [Export] - public float Bounds = 700f; //px Pos to loop or do something at. + public float LoopOffset = 700f; //px Pos to loop or do something at. // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) { Vector2 newPos = Position; + float interval = TimeKeeper.ChartLength; + double relativePosition = + TimeKeeper.CurrentTime / TimeKeeper.LoopLength * TimeKeeper.ChartLength; //Loop position over the course of time across a loop newPos.X = - (float)( - (-TimeKeeper.CurrentTime / TimeKeeper.LoopLength * TimeKeeper.ChartLength) - % TimeKeeper.ChartLength - / 2 - ) + Bounds; - Position = newPos; + (float)( //Yes I know. https://www.desmos.com/calculator/fkmoqi50ee + (TimeKeeper.PosMod(-relativePosition - interval / 2, interval) - interval / 2) / 2 + ) + LoopOffset; + if (!float.IsNaN(newPos.X)) + Position = newPos; } } diff --git a/scenes/ChartViewport/StarryNight.gdshader b/scenes/ChartViewport/StarryNight.gdshader new file mode 100644 index 00000000..126e5eab --- /dev/null +++ b/scenes/ChartViewport/StarryNight.gdshader @@ -0,0 +1,27 @@ +//based on this star shader. Thanks gerardogc2378 +//https://godotshaders.com/shader/stars-shader/ + +shader_type canvas_item; + +uniform vec4 bg_top_color; +uniform vec4 bg_bottom_color; +uniform float gradient_ratio; +uniform float time_scale; + +float rand(vec2 st) { + return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123); +} + +void fragment() { + float color = 0.0; + + if (rand(SCREEN_UV.xy / 20.0) > 0.996) + { + float r = rand(SCREEN_UV.xy); + color = r * (0.85 * sin((TIME * time_scale) * (r * 5.0) + 720.0 * r) + 0.95); + } + + vec4 gradient_color = mix(bg_top_color, bg_bottom_color, SCREEN_UV.y / gradient_ratio); + + COLOR = vec4(vec3(color),1.0) + gradient_color; +} \ No newline at end of file diff --git a/scenes/ChestScene/ChestScene.cs b/scenes/ChestScene/ChestScene.cs new file mode 100644 index 00000000..4688d79f --- /dev/null +++ b/scenes/ChestScene/ChestScene.cs @@ -0,0 +1,40 @@ +using System; +using FunkEngine; +using Godot; + +public partial class ChestScene : Node2D +{ + public PlayerPuppet Player; + + [Export] + public Button ChestButton; + + public override void _Ready() + { + Player = GD.Load("res://scenes/Puppets/PlayerPuppet.tscn") + .Instantiate(); + AddChild(Player); + + ChestButton.Pressed += GetLoot; + } + + public override void _Process(double delta) + { + if (!ChestButton.Disabled) + { + ChestButton.GrabFocus(); + } + } + + private void GetLoot() + { + ChestButton.Disabled = true; + RewardSelect.CreateSelection(this, Player.Stats, 3).Selected += EndBattle; + } + + private void EndBattle() + { + StageProducer.ChangeCurRoom(StageProducer.Config.BattleRoom); + GetNode("/root/StageProducer").TransitionStage(Stages.Map); + } +} diff --git a/scenes/ChestScene/ChestScene.tscn b/scenes/ChestScene/ChestScene.tscn new file mode 100644 index 00000000..ccce24e2 --- /dev/null +++ b/scenes/ChestScene/ChestScene.tscn @@ -0,0 +1,39 @@ +[gd_scene load_steps=7 format=3 uid="uid://c4vmb783d3v03"] + +[ext_resource type="Script" path="res://scenes/ChestScene/ChestScene.cs" id="1_ardd2"] +[ext_resource type="AudioStream" uid="uid://cv6lqjj6lu36h" path="res://Audio/335571__magntron__gamemusic_120bpm.mp3" id="2_ogp8i"] +[ext_resource type="Script" path="res://scenes/UI/scripts/MenuModule.cs" id="3_5uvci"] +[ext_resource type="Texture2D" uid="uid://qhwve7fik4do" path="res://scenes/BattleDirector/assets/bgupdate.png" id="6_37nar"] +[ext_resource type="Texture2D" uid="uid://d0ywqw1j1k71v" path="res://scenes/ChestScene/assets/Chest.png" id="6_58hf4"] +[ext_resource type="Texture2D" uid="uid://dbjotl0v1ymia" path="res://scenes/BattleDirector/assets/BattleFrame1.png" id="7_kkck7"] + +[node name="ChestScene" type="Node2D" node_paths=PackedStringArray("ChestButton")] +process_mode = 1 +script = ExtResource("1_ardd2") +ChestButton = NodePath("ChestButton") + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("2_ogp8i") + +[node name="UILayer" type="CanvasLayer" parent="."] +script = ExtResource("3_5uvci") + +[node name="BackGround" type="TextureRect" parent="."] +z_index = -1 +offset_right = 640.0 +offset_bottom = 178.0 +texture = ExtResource("6_37nar") + +[node name="BattleFrame" type="TextureRect" parent="."] +z_index = 1 +offset_top = 178.0 +offset_right = 640.0 +offset_bottom = 360.0 +texture = ExtResource("7_kkck7") + +[node name="ChestButton" type="Button" parent="."] +offset_left = 375.0 +offset_top = 126.0 +offset_right = 431.0 +offset_bottom = 166.0 +icon = ExtResource("6_58hf4") diff --git a/scenes/ChestScene/assets/Chest.png b/scenes/ChestScene/assets/Chest.png new file mode 100644 index 00000000..2763b052 Binary files /dev/null and b/scenes/ChestScene/assets/Chest.png differ diff --git a/scenes/BattleDirector/assets/CoolBG.jpg.import b/scenes/ChestScene/assets/Chest.png.import similarity index 67% rename from scenes/BattleDirector/assets/CoolBG.jpg.import rename to scenes/ChestScene/assets/Chest.png.import index e4f537c4..2f5a70d2 100644 --- a/scenes/BattleDirector/assets/CoolBG.jpg.import +++ b/scenes/ChestScene/assets/Chest.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://ci0g72j8q4ec2" -path="res://.godot/imported/CoolBG.jpg-3bad5dc436fec2c6453223cfa1feeeb8.ctex" +uid="uid://d0ywqw1j1k71v" +path="res://.godot/imported/Chest.png-fb3cdf8f34ea60a7ae2cb63e4d6ad62a.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://scenes/BattleDirector/assets/CoolBG.jpg" -dest_files=["res://.godot/imported/CoolBG.jpg-3bad5dc436fec2c6453223cfa1feeeb8.ctex"] +source_file="res://scenes/ChestScene/assets/Chest.png" +dest_files=["res://.godot/imported/Chest.png-fb3cdf8f34ea60a7ae2cb63e4d6ad62a.ctex"] [params] diff --git a/scenes/Maps/assets/BattleIcon.png b/scenes/Maps/assets/BattleIcon.png new file mode 100644 index 00000000..a93306c1 Binary files /dev/null and b/scenes/Maps/assets/BattleIcon.png differ diff --git a/scenes/Maps/assets/BattleIcon.png.import b/scenes/Maps/assets/BattleIcon.png.import new file mode 100644 index 00000000..7e2ba8f7 --- /dev/null +++ b/scenes/Maps/assets/BattleIcon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://7ius17ox1e70" +path="res://.godot/imported/BattleIcon.png-7774ff140253fc7228adca1e1cc84da5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/Maps/assets/BattleIcon.png" +dest_files=["res://.godot/imported/BattleIcon.png-7774ff140253fc7228adca1e1cc84da5.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/Maps/assets/BossIcon.png b/scenes/Maps/assets/BossIcon.png new file mode 100644 index 00000000..565eb878 Binary files /dev/null and b/scenes/Maps/assets/BossIcon.png differ diff --git a/scenes/Maps/assets/BossIcon.png.import b/scenes/Maps/assets/BossIcon.png.import new file mode 100644 index 00000000..8954c123 --- /dev/null +++ b/scenes/Maps/assets/BossIcon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://xwx7j1wufwx1" +path="res://.godot/imported/BossIcon.png-d10acdd0cb08fa24b6fb43e6a501cfba.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/Maps/assets/BossIcon.png" +dest_files=["res://.godot/imported/BossIcon.png-d10acdd0cb08fa24b6fb43e6a501cfba.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/Maps/assets/ChestIcon.png b/scenes/Maps/assets/ChestIcon.png new file mode 100644 index 00000000..d4686e92 Binary files /dev/null and b/scenes/Maps/assets/ChestIcon.png differ diff --git a/scenes/Maps/assets/ChestIcon.png.import b/scenes/Maps/assets/ChestIcon.png.import new file mode 100644 index 00000000..7b4992d1 --- /dev/null +++ b/scenes/Maps/assets/ChestIcon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://othbopej2fym" +path="res://.godot/imported/ChestIcon.png-83b4a439102e920a2f15bc896417dcfc.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/Maps/assets/ChestIcon.png" +dest_files=["res://.godot/imported/ChestIcon.png-83b4a439102e920a2f15bc896417dcfc.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/Maps/assets/Player.png b/scenes/Maps/assets/Player.png new file mode 100644 index 00000000..ba949b59 Binary files /dev/null and b/scenes/Maps/assets/Player.png differ diff --git a/scenes/Maps/assets/Player.png.import b/scenes/Maps/assets/Player.png.import new file mode 100644 index 00000000..f61770d4 --- /dev/null +++ b/scenes/Maps/assets/Player.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cmc7gcplqnebx" +path="res://.godot/imported/Player.png-7fca1835a2d8df851a542a69dff404ad.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/Maps/assets/Player.png" +dest_files=["res://.godot/imported/Player.png-7fca1835a2d8df851a542a69dff404ad.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/Maps/cartographer.tscn b/scenes/Maps/cartographer.tscn index a6497a78..3fe2121b 100644 --- a/scenes/Maps/cartographer.tscn +++ b/scenes/Maps/cartographer.tscn @@ -1,6 +1,24 @@ -[gd_scene load_steps=2 format=3 uid="uid://cydmo2lbnj1de"] +[gd_scene load_steps=5 format=3 uid="uid://cydmo2lbnj1de"] [ext_resource type="Script" path="res://scenes/Maps/scripts/Cartographer.cs" id="1_u4q3n"] +[ext_resource type="Texture2D" uid="uid://qhwve7fik4do" path="res://scenes/BattleDirector/assets/bgupdate.png" id="2_5g6at"] +[ext_resource type="Script" path="res://scenes/UI/scripts/MenuModule.cs" id="2_cl7v0"] +[ext_resource type="Texture2D" uid="uid://cmc7gcplqnebx" path="res://scenes/Maps/assets/Player.png" id="3_qiprp"] -[node name="Cartographer" type="Node2D"] +[node name="Cartographer" type="Node2D" node_paths=PackedStringArray("PlayerSprite")] +process_mode = 1 script = ExtResource("1_u4q3n") +PlayerSprite = NodePath("Player") + +[node name="UI" type="CanvasLayer" parent="."] +script = ExtResource("2_cl7v0") + +[node name="BG" type="Sprite2D" parent="."] +modulate = Color(0.462, 0.462, 0.66, 1) +position = Vector2(870, 219) +scale = Vector2(2.75702, 2.75702) +texture = ExtResource("2_5g6at") + +[node name="Player" type="Sprite2D" parent="."] +z_index = 2 +texture = ExtResource("3_qiprp") diff --git a/scenes/Maps/scripts/Cartographer.cs b/scenes/Maps/scripts/Cartographer.cs index 638dcd75..473de0d5 100644 --- a/scenes/Maps/scripts/Cartographer.cs +++ b/scenes/Maps/scripts/Cartographer.cs @@ -5,9 +5,32 @@ public partial class Cartographer : Node2D { + [Export] + public Sprite2D PlayerSprite; + + private Button[] _validButtons = Array.Empty