diff --git a/Audio/335571__magntron__gamemusic_120bpm.mp3 b/Audio/335571__magntron__gamemusic_120bpm.mp3 deleted file mode 100644 index de6a511f..00000000 Binary files a/Audio/335571__magntron__gamemusic_120bpm.mp3 and /dev/null differ diff --git a/Audio/335571__magntron__gamemusic_120bpm.mp3.import b/Audio/335571__magntron__gamemusic_120bpm.mp3.import deleted file mode 100644 index 9c209bfe..00000000 --- a/Audio/335571__magntron__gamemusic_120bpm.mp3.import +++ /dev/null @@ -1,19 +0,0 @@ -[remap] - -importer="mp3" -type="AudioStreamMP3" -uid="uid://cv6lqjj6lu36h" -path="res://.godot/imported/335571__magntron__gamemusic_120bpm.mp3-a87b357c4b3c9199709863b47f78bd2a.mp3str" - -[deps] - -source_file="res://Audio/335571__magntron__gamemusic_120bpm.mp3" -dest_files=["res://.godot/imported/335571__magntron__gamemusic_120bpm.mp3-a87b357c4b3c9199709863b47f78bd2a.mp3str"] - -[params] - -loop=true -loop_offset=0 -bpm=0 -beat_count=0 -bar_beats=4 diff --git a/Audio/Song1.ogg b/Audio/Song1.ogg new file mode 100644 index 00000000..93d476e9 Binary files /dev/null and b/Audio/Song1.ogg differ diff --git a/Audio/Song1.ogg.import b/Audio/Song1.ogg.import new file mode 100644 index 00000000..f207d392 --- /dev/null +++ b/Audio/Song1.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://iq0xxe5cggs8" +path="res://.godot/imported/Song1.ogg-1d785b9ae3fbaa8393048e39af66ed86.oggvorbisstr" + +[deps] + +source_file="res://Audio/Song1.ogg" +dest_files=["res://.godot/imported/Song1.ogg-1d785b9ae3fbaa8393048e39af66ed86.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/Audio/Song2.ogg b/Audio/Song2.ogg new file mode 100644 index 00000000..063129c0 Binary files /dev/null and b/Audio/Song2.ogg differ diff --git a/Audio/Song2.ogg.import b/Audio/Song2.ogg.import new file mode 100644 index 00000000..73b81ccf --- /dev/null +++ b/Audio/Song2.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://ckis6k6vuums" +path="res://.godot/imported/Song2.ogg-b95c04f3512de6fa42e0f9c35aba831f.oggvorbisstr" + +[deps] + +source_file="res://Audio/Song2.ogg" +dest_files=["res://.godot/imported/Song2.ogg-b95c04f3512de6fa42e0f9c35aba831f.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0.0 +bpm=0.0 +beat_count=0 +bar_beats=4 diff --git a/Audio/Song3.ogg b/Audio/Song3.ogg new file mode 100644 index 00000000..58f8028c Binary files /dev/null and b/Audio/Song3.ogg differ diff --git a/Audio/Song3.ogg.import b/Audio/Song3.ogg.import new file mode 100644 index 00000000..8276c383 --- /dev/null +++ b/Audio/Song3.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://ceyw5mjkem2pi" +path="res://.godot/imported/Song3.ogg-d4e6a5f1a550561df18989fb495ba591.oggvorbisstr" + +[deps] + +source_file="res://Audio/Song3.ogg" +dest_files=["res://.godot/imported/Song3.ogg-d4e6a5f1a550561df18989fb495ba591.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0.0 +bpm=0.0 +beat_count=0 +bar_beats=4 diff --git a/Audio/midi/Song1.mid b/Audio/midi/Song1.mid new file mode 100644 index 00000000..3330b86a Binary files /dev/null and b/Audio/midi/Song1.mid differ diff --git a/Audio/midi/Song2.mid b/Audio/midi/Song2.mid new file mode 100644 index 00000000..c657321a Binary files /dev/null and b/Audio/midi/Song2.mid differ diff --git a/Audio/midi/Song3.mid b/Audio/midi/Song3.mid new file mode 100644 index 00000000..58e53a49 Binary files /dev/null and b/Audio/midi/Song3.mid differ 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/Classes/MidiMaestro/MidiMaestro.cs b/Classes/MidiMaestro/MidiMaestro.cs new file mode 100644 index 00000000..e6e42180 --- /dev/null +++ b/Classes/MidiMaestro/MidiMaestro.cs @@ -0,0 +1,112 @@ +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 float GetStartTimeSeconds() => + _note.TimeAs(_tempoMap).Milliseconds / 1000f + + _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..bf63c2b9 --- /dev/null +++ b/Classes/MidiMaestro/SongTemplate.cs @@ -0,0 +1,25 @@ +namespace FunkEngine.Classes.MidiMaestro; + +public partial class SongTemplate +{ + public string Name; + public string AudioLocation; + public string MIDILocation; + public string EnemyScenePath; + public SongData SongData; + + public SongTemplate( + SongData songData, + string name = "", + string audioLocation = "", + string midiLocation = "", + string enemyScenePath = "" + ) + { + Name = name; + AudioLocation = audioLocation; + MIDILocation = midiLocation; + SongData = songData; + EnemyScenePath = enemyScenePath; + } +} 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/Globals/FunkEngineNameSpace.cs b/Globals/FunkEngineNameSpace.cs index 04c05161..a4de4533 100644 --- a/Globals/FunkEngineNameSpace.cs +++ b/Globals/FunkEngineNameSpace.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using FunkEngine.Classes.MidiMaestro; using Godot; namespace FunkEngine; @@ -40,8 +41,8 @@ public struct BattleConfig { public Stages RoomType; public MapGrid.Room BattleRoom; - public int TodoEnemyAndChart; - public SongData CurSong; + public string EnemyScenePath; + public SongTemplate CurSong; } public enum BattleEffectTrigger diff --git a/Globals/Scribe.cs b/Globals/Scribe.cs index 376350d8..cb3160d0 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; /** @@ -151,7 +152,46 @@ public partial class Scribe : Node ), }; - //TODO: Item pool(s) + public static readonly SongTemplate[] SongDictionary = new[] + { + new SongTemplate( + new SongData + { + Bpm = 120, + SongLength = -1, + NumLoops = 5, + }, + "Song1", + "Audio/Song1.ogg", + "Audio/midi/song1.mid" + ), + new SongTemplate( + new SongData + { + Bpm = 60, + SongLength = -1, + NumLoops = 1, + }, + "Song2", + "Audio/Song2.ogg", + "Audio/midi/Song2.mid", + "res://scenes/Puppets/Enemies/Parasifly/Parasifly.tscn" + ), + new SongTemplate( + new SongData + { + Bpm = 120, + SongLength = -1, + NumLoops = 1, + }, + "Song3", + "Audio/Song3.ogg", + "Audio/midi/Song3.mid", + "res://scenes/Puppets/Enemies/TheGWS/GWS.tscn" + ), + }; + + //TODO: Item pool(s) public static RelicTemplate[] GetRandomRelics(RelicTemplate[] ownedRelics, int count) { @@ -171,7 +211,7 @@ public static RelicTemplate[] GetRandomRelics(RelicTemplate[] ownedRelics, int c } return availableRelics; } - + public static Note[] GetRandomRewardNotes(int count) { var availableNotes = Scribe diff --git a/Globals/StageProducer.cs b/Globals/StageProducer.cs index 21b49376..4c9ab37b 100644 --- a/Globals/StageProducer.cs +++ b/Globals/StageProducer.cs @@ -28,6 +28,7 @@ public partial class StageProducer : Node public void StartGame() { Map.InitMapGrid(MapSize.X, MapSize.Y, 3); + GlobalRng.Randomize(); _seed = GlobalRng.Seed; _lastRngState = GlobalRng.State; PlayerStats = new PlayerStats(); @@ -59,6 +60,10 @@ public void TransitionStage(Stages nextStage, int nextRoomIdx = -1) Config = MakeConfig(nextStage, nextRoomIdx); GetTree().ChangeSceneToFile("res://scenes/BattleDirector/test_battle_scene.tscn"); break; + case Stages.Boss: + 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; @@ -90,14 +95,17 @@ 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) + switch (nextRoom) { - result.CurSong = new SongData - { - Bpm = 120, - SongLength = -1, - NumLoops = 5, - }; + case Stages.Battle: + int songIdx = GlobalRng.RandiRange(1, 2); + result.CurSong = Scribe.SongDictionary[songIdx]; + result.EnemyScenePath = Scribe.SongDictionary[songIdx].EnemyScenePath; + break; + case Stages.Boss: + result.EnemyScenePath = "res://scenes/Puppets/Enemies/BossBlood/Boss1.tscn"; + result.CurSong = Scribe.SongDictionary[0]; + break; } return result; diff --git a/scenes/BattleDirector/scripts/BattleDirector.cs b/scenes/BattleDirector/scripts/BattleDirector.cs index 95bde41d..3ea550a8 100644 --- a/scenes/BattleDirector/scripts/BattleDirector.cs +++ b/scenes/BattleDirector/scripts/BattleDirector.cs @@ -14,7 +14,7 @@ public partial class BattleDirector : Node2D #region Declarations public PlayerPuppet Player; - public PuppetTemplate Enemy; + public EnemyPuppet Enemy; [Export] private ChartManager CM; @@ -62,7 +62,8 @@ public PuppetTemplate GetTarget(Note note) public override void _Ready() { //TODO: Should come from transition into battle - _curSong = StageProducer.Config.CurSong; + _curSong = StageProducer.Config.CurSong.SongData; + Audio.SetStream(GD.Load(StageProducer.Config.CurSong.AudioLocation)); if (_curSong.SongLength <= 0) { _curSong.SongLength = Audio.Stream.GetLength(); @@ -77,8 +78,8 @@ public override void _Ready() NotePlacementBar.Setup(StageProducer.PlayerStats); //TODO: Refine - Enemy = GD.Load("res://scenes/Puppets/Enemies/Boss1.tscn") - .Instantiate(); + Enemy = GD.Load(StageProducer.Config.EnemyScenePath) + .Instantiate(); AddChild(Enemy); Enemy.Defeated += CheckBattleStatus; @@ -102,15 +103,6 @@ private void Begin() CD.Prep(); CD.TimedInput += OnTimedInput; - //TODO: Make enemies, can put this in an enemy subclass - var enemTween = CreateTween(); - enemTween.TweenProperty(Enemy.Sprite, "position", Vector2.Down * 5, 1f).AsRelative(); - enemTween.TweenProperty(Enemy.Sprite, "position", Vector2.Up * 5, 1f).AsRelative(); - enemTween.SetTrans(Tween.TransitionType.Spring); - enemTween.SetEase(Tween.EaseType.In); - enemTween.SetLoops(); - enemTween.Play(); - CM.Connect(nameof(InputHandler.NotePressed), new Callable(this, nameof(OnNotePressed))); CM.Connect(nameof(InputHandler.NoteReleased), new Callable(this, nameof(OnNoteReleased))); diff --git a/scenes/BattleDirector/scripts/Conductor.cs b/scenes/BattleDirector/scripts/Conductor.cs index 7c02677a..eaa43e31 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; @@ -44,8 +45,7 @@ public bool AddNoteToLane(ArrowType type, int beat, Note note, bool isActive = t { beat %= CM.BeatsPerLoop; Note newNote = note.Clone(); - - if (beat == 0) + if (beat == 0 || _laneData[(int)type][beat] != null) return false; NoteArrow arrow; @@ -63,6 +63,11 @@ public bool AddNoteToLane(ArrowType type, int beat, Note note, bool isActive = t return true; } + public override void _Ready() + { + MM = new MidiMaestro(StageProducer.Config.CurSong.MIDILocation); + } + public void Prep() //TODO: Streamline battle initialization { _laneData = new NoteArrow[][] @@ -78,24 +83,16 @@ public void Prep() //TODO: Streamline battle initialization private void AddExampleNotes() { GD.Print(CM.BeatsPerLoop); - for (int i = 1; i < 15; i++) + foreach (ArrowType type in Enum.GetValues(typeof(ArrowType))) { - AddNoteToLane(ArrowType.Up, i * 4, Scribe.NoteDictionary[0]); - } - - for (int i = 1; i < 15; i++) - { - AddNoteToLane(ArrowType.Left, 4 * i + 1, Scribe.NoteDictionary[0]); - } - - for (int i = 0; i < 10; i++) - { - AddNoteToLane(ArrowType.Right, 3 * i + 32, Scribe.NoteDictionary[0]); - } - - for (int i = 0; i < 3; i++) - { - AddNoteToLane(ArrowType.Down, 8 * i + 16, Scribe.NoteDictionary[0]); + foreach (midiNoteInfo mNote in MM.GetNotes(type)) + { + AddNoteToLane( + type, + (int)(mNote.GetStartTimeSeconds() / (60 / (double)TimeKeeper.Bpm)), + Scribe.NoteDictionary[0] + ); + } } } diff --git a/scenes/BattleDirector/test_battle_scene.tscn b/scenes/BattleDirector/test_battle_scene.tscn index 12ab120a..9269b167 100644 --- a/scenes/BattleDirector/test_battle_scene.tscn +++ b/scenes/BattleDirector/test_battle_scene.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://b0mrgr7h0ty1y"] +[gd_scene load_steps=10 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"] @@ -7,7 +7,6 @@ [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) @@ -28,7 +27,6 @@ Audio = NodePath("AudioStreamPlayer") metadata/_edit_lock_ = true [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] -stream = ExtResource("8_caqms") [node name="UILayer" type="CanvasLayer" parent="."] script = ExtResource("3_8hff6") diff --git a/scenes/Maps/scripts/Cartographer.cs b/scenes/Maps/scripts/Cartographer.cs index 473de0d5..545c9b88 100644 --- a/scenes/Maps/scripts/Cartographer.cs +++ b/scenes/Maps/scripts/Cartographer.cs @@ -23,7 +23,7 @@ public override void _Process(double delta) { if (!GetTree().Paused && !_validButtons.Contains(GetViewport().GuiGetFocusOwner())) { - _focusedButton.GrabFocus(); + _focusedButton?.GrabFocus(); } } diff --git a/scenes/Puppets/Enemies/Boss1.tscn b/scenes/Puppets/Enemies/BossBlood/Boss1.tscn similarity index 74% rename from scenes/Puppets/Enemies/Boss1.tscn rename to scenes/Puppets/Enemies/BossBlood/Boss1.tscn index 9ee3ee20..7a34972f 100644 --- a/scenes/Puppets/Enemies/Boss1.tscn +++ b/scenes/Puppets/Enemies/BossBlood/Boss1.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=8 format=3 uid="uid://bi5iqbwpsd381"] -[ext_resource type="Script" path="res://scenes/Puppets/scripts/PuppetTemplate.cs" id="1_310x1"] -[ext_resource type="Texture2D" uid="uid://veedngaorx3l" path="res://scenes/BattleDirector/assets/Enemy1.png" id="2_bxcx7"] -[ext_resource type="Texture2D" uid="uid://b2iptr3o8rg4t" path="res://scenes/Puppets/Enemies/assets/Boss1EmissionShape.tres" id="3_ct4k8"] -[ext_resource type="PackedScene" uid="uid://bgomxovxs7sr8" path="res://scenes/Puppets/HealthBar.tscn" id="3_otelj"] +[ext_resource type="Script" path="res://scenes/Puppets/Enemies/BossBlood/P_BossBlood.cs" id="1_qj2oj"] +[ext_resource type="Texture2D" uid="uid://veedngaorx3l" path="res://scenes/BattleDirector/assets/Enemy1.png" id="2_mul30"] +[ext_resource type="Texture2D" uid="uid://b2iptr3o8rg4t" path="res://scenes/Puppets/Enemies/BossBlood/assets/Boss1EmissionShape.tres" id="3_yxnso"] +[ext_resource type="PackedScene" uid="uid://bgomxovxs7sr8" path="res://scenes/Puppets/HealthBar.tscn" id="4_ffkxf"] [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_3jiu6"] emission_shape = 4 -emission_point_texture = ExtResource("3_ct4k8") +emission_point_texture = ExtResource("3_yxnso") emission_point_count = 1078 gravity = Vector3(0, 98, 0) scale_min = 4.0 @@ -23,7 +23,7 @@ gradient = SubResource("Gradient_s7p55") width = 1 [node name="EnemPuppet" type="Node2D" node_paths=PackedStringArray("_healthBar", "Sprite")] -script = ExtResource("1_310x1") +script = ExtResource("1_qj2oj") _healthBar = NodePath("ProgressBar") Sprite = NodePath("Sprite") StartPos = Vector2(500, 125) @@ -31,7 +31,7 @@ InitScale = Vector2(2, 2) [node name="Sprite" type="Sprite2D" parent="."] position = Vector2(0, -32) -texture = ExtResource("2_bxcx7") +texture = ExtResource("2_mul30") [node name="Blood Particles" type="GPUParticles2D" parent="Sprite"] z_index = -1 @@ -42,7 +42,7 @@ texture = SubResource("GradientTexture1D_16sp0") lifetime = 2.0 trail_lifetime = 10.0 -[node name="ProgressBar" parent="." instance=ExtResource("3_otelj")] +[node name="ProgressBar" parent="." instance=ExtResource("4_ffkxf")] offset_left = -75.0 offset_top = 32.0 offset_right = 75.0 diff --git a/scenes/Puppets/Enemies/BossBlood/P_BossBlood.cs b/scenes/Puppets/Enemies/BossBlood/P_BossBlood.cs new file mode 100644 index 00000000..8c19a9b2 --- /dev/null +++ b/scenes/Puppets/Enemies/BossBlood/P_BossBlood.cs @@ -0,0 +1,17 @@ +using System; +using Godot; + +public partial class P_BossBlood : EnemyPuppet +{ + public override void _Ready() + { + base._Ready(); + var enemTween = CreateTween(); + enemTween.TweenProperty(Sprite, "position", Vector2.Down * 5, 1f).AsRelative(); + enemTween.TweenProperty(Sprite, "position", Vector2.Up * 5, 1f).AsRelative(); + enemTween.SetTrans(Tween.TransitionType.Spring); + enemTween.SetEase(Tween.EaseType.In); + enemTween.SetLoops(); + enemTween.Play(); + } +} diff --git a/scenes/Puppets/Enemies/assets/Boss1EmissionShape.tres b/scenes/Puppets/Enemies/BossBlood/assets/Boss1EmissionShape.tres similarity index 100% rename from scenes/Puppets/Enemies/assets/Boss1EmissionShape.tres rename to scenes/Puppets/Enemies/BossBlood/assets/Boss1EmissionShape.tres diff --git a/scenes/Puppets/Enemies/assets/Enemy1.png.import b/scenes/Puppets/Enemies/BossBlood/assets/Enemy1.png.import similarity index 100% rename from scenes/Puppets/Enemies/assets/Enemy1.png.import rename to scenes/Puppets/Enemies/BossBlood/assets/Enemy1.png.import diff --git a/scenes/Puppets/Enemies/assets/Enemy1EmissionShape.png b/scenes/Puppets/Enemies/BossBlood/assets/Enemy1EmissionShape.png similarity index 100% rename from scenes/Puppets/Enemies/assets/Enemy1EmissionShape.png rename to scenes/Puppets/Enemies/BossBlood/assets/Enemy1EmissionShape.png diff --git a/scenes/Puppets/Enemies/assets/Enemy1EmissionShape.png.import b/scenes/Puppets/Enemies/BossBlood/assets/Enemy1EmissionShape.png.import similarity index 67% rename from scenes/Puppets/Enemies/assets/Enemy1EmissionShape.png.import rename to scenes/Puppets/Enemies/BossBlood/assets/Enemy1EmissionShape.png.import index 853abc22..e6e2721d 100644 --- a/scenes/Puppets/Enemies/assets/Enemy1EmissionShape.png.import +++ b/scenes/Puppets/Enemies/BossBlood/assets/Enemy1EmissionShape.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://b5jpi2i502lw5" -path="res://.godot/imported/Enemy1EmissionShape.png-e1502c3313247b217f7d453af1069017.ctex" +path="res://.godot/imported/Enemy1EmissionShape.png-b52ecd60b2d507b2c2133463b0dcbc08.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://scenes/Puppets/Enemies/assets/Enemy1EmissionShape.png" -dest_files=["res://.godot/imported/Enemy1EmissionShape.png-e1502c3313247b217f7d453af1069017.ctex"] +source_file="res://scenes/Puppets/Enemies/BossBlood/assets/Enemy1EmissionShape.png" +dest_files=["res://.godot/imported/Enemy1EmissionShape.png-b52ecd60b2d507b2c2133463b0dcbc08.ctex"] [params] diff --git a/scenes/Puppets/Enemies/EnemyPuppet.cs b/scenes/Puppets/Enemies/EnemyPuppet.cs new file mode 100644 index 00000000..97c39da9 --- /dev/null +++ b/scenes/Puppets/Enemies/EnemyPuppet.cs @@ -0,0 +1,7 @@ +using System; +using Godot; + +public partial class EnemyPuppet : PuppetTemplate +{ + //TODO: What do enemies need? +} diff --git a/scenes/Puppets/Enemies/Parasifly/P_Parasifly.cs b/scenes/Puppets/Enemies/Parasifly/P_Parasifly.cs new file mode 100644 index 00000000..388d6f2f --- /dev/null +++ b/scenes/Puppets/Enemies/Parasifly/P_Parasifly.cs @@ -0,0 +1,17 @@ +using System; +using Godot; + +public partial class P_Parasifly : EnemyPuppet +{ + public override void _Ready() + { + base._Ready(); + var enemTween = CreateTween(); + enemTween.TweenProperty(Sprite, "position", Vector2.Down * 2, 2f).AsRelative(); + enemTween.TweenProperty(Sprite, "position", Vector2.Up * 2, 2f).AsRelative(); + enemTween.SetTrans(Tween.TransitionType.Linear); + enemTween.SetEase(Tween.EaseType.In); + enemTween.SetLoops(); + enemTween.Play(); + } +} diff --git a/scenes/Puppets/Enemies/Parasifly/Parasifly.tscn b/scenes/Puppets/Enemies/Parasifly/Parasifly.tscn new file mode 100644 index 00000000..eda1478a --- /dev/null +++ b/scenes/Puppets/Enemies/Parasifly/Parasifly.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=4 format=3 uid="uid://uvlux4t6h5de"] + +[ext_resource type="Script" path="res://scenes/Puppets/Enemies/Parasifly/P_Parasifly.cs" id="1_ci2ca"] +[ext_resource type="Texture2D" uid="uid://pngu3pw1pu4o" path="res://scenes/Puppets/Enemies/Parasifly/assets/Parasifly.png" id="2_g4o48"] +[ext_resource type="PackedScene" uid="uid://bgomxovxs7sr8" path="res://scenes/Puppets/HealthBar.tscn" id="3_f74ri"] + +[node name="EnemPuppet" type="Node2D" node_paths=PackedStringArray("_healthBar", "Sprite")] +script = ExtResource("1_ci2ca") +_healthBar = NodePath("ProgressBar") +Sprite = NodePath("Sprite") +StartPos = Vector2(500, 125) + +[node name="Sprite" type="Sprite2D" parent="."] +position = Vector2(0, -12) +texture = ExtResource("2_g4o48") + +[node name="ProgressBar" parent="." instance=ExtResource("3_f74ri")] +offset_left = -75.0 +offset_top = 32.0 +offset_right = 75.0 +offset_bottom = 52.0 diff --git a/scenes/Puppets/Enemies/Parasifly/assets/Parasifly.png b/scenes/Puppets/Enemies/Parasifly/assets/Parasifly.png new file mode 100644 index 00000000..2f52bdcb Binary files /dev/null and b/scenes/Puppets/Enemies/Parasifly/assets/Parasifly.png differ diff --git a/scenes/Puppets/Enemies/Parasifly/assets/Parasifly.png.import b/scenes/Puppets/Enemies/Parasifly/assets/Parasifly.png.import new file mode 100644 index 00000000..baf2af11 --- /dev/null +++ b/scenes/Puppets/Enemies/Parasifly/assets/Parasifly.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://pngu3pw1pu4o" +path="res://.godot/imported/Parasifly.png-505ed58d09842f4f662770b57ebb5c8b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/Puppets/Enemies/Parasifly/assets/Parasifly.png" +dest_files=["res://.godot/imported/Parasifly.png-505ed58d09842f4f662770b57ebb5c8b.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/Puppets/Enemies/TheGWS/GWS.tscn b/scenes/Puppets/Enemies/TheGWS/GWS.tscn new file mode 100644 index 00000000..b9d7708d --- /dev/null +++ b/scenes/Puppets/Enemies/TheGWS/GWS.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=4 format=3 uid="uid://d1puw6fvmkrb5"] + +[ext_resource type="Script" path="res://scenes/Puppets/Enemies/TheGWS/P_TheGWS.cs" id="1_dlike"] +[ext_resource type="Texture2D" uid="uid://ci0a2h2eatjht" path="res://scenes/Puppets/Enemies/TheGWS/assets/GhostWolfSnake.png" id="2_77v4w"] +[ext_resource type="PackedScene" uid="uid://bgomxovxs7sr8" path="res://scenes/Puppets/HealthBar.tscn" id="3_mr0it"] + +[node name="EnemPuppet" type="Node2D" node_paths=PackedStringArray("_healthBar", "Sprite")] +script = ExtResource("1_dlike") +_healthBar = NodePath("ProgressBar") +Sprite = NodePath("Sprite") +StartPos = Vector2(500, 125) + +[node name="Sprite" type="Sprite2D" parent="."] +position = Vector2(0, -54) +texture = ExtResource("2_77v4w") + +[node name="ProgressBar" parent="." instance=ExtResource("3_mr0it")] +offset_left = -75.0 +offset_top = 32.0 +offset_right = 75.0 +offset_bottom = 52.0 diff --git a/scenes/Puppets/Enemies/TheGWS/P_TheGWS.cs b/scenes/Puppets/Enemies/TheGWS/P_TheGWS.cs new file mode 100644 index 00000000..491d447c --- /dev/null +++ b/scenes/Puppets/Enemies/TheGWS/P_TheGWS.cs @@ -0,0 +1,17 @@ +using System; +using Godot; + +public partial class P_TheGWS : EnemyPuppet +{ + public override void _Ready() + { + base._Ready(); + var enemTween = CreateTween(); + enemTween.TweenProperty(Sprite, "position", Vector2.Down * 10, 3f).AsRelative(); + enemTween.TweenProperty(Sprite, "position", Vector2.Up * 10, 3f).AsRelative(); + enemTween.SetTrans(Tween.TransitionType.Quad); + enemTween.SetEase(Tween.EaseType.InOut); + enemTween.SetLoops(); + enemTween.Play(); + } +} diff --git a/scenes/Puppets/Enemies/TheGWS/assets/GhostWolfSnake.png b/scenes/Puppets/Enemies/TheGWS/assets/GhostWolfSnake.png new file mode 100644 index 00000000..96a1505d Binary files /dev/null and b/scenes/Puppets/Enemies/TheGWS/assets/GhostWolfSnake.png differ diff --git a/scenes/Puppets/Enemies/TheGWS/assets/GhostWolfSnake.png.import b/scenes/Puppets/Enemies/TheGWS/assets/GhostWolfSnake.png.import new file mode 100644 index 00000000..74a94dac --- /dev/null +++ b/scenes/Puppets/Enemies/TheGWS/assets/GhostWolfSnake.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ci0a2h2eatjht" +path="res://.godot/imported/GhostWolfSnake.png-6a5e038cc9802e04c7700f7f9b1f8a8f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/Puppets/Enemies/TheGWS/assets/GhostWolfSnake.png" +dest_files=["res://.godot/imported/GhostWolfSnake.png-6a5e038cc9802e04c7700f7f9b1f8a8f.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