From 28962d36abcc4ab747e98692421b781fc1a29f49 Mon Sep 17 00:00:00 2001 From: John Pavek Date: Mon, 6 Nov 2023 19:16:44 -0600 Subject: [PATCH] Mid work commit, because this actually looks okay --- Components/Effect.cs | 1 + NovemberPirates.sln | 1 + Readme.md | 22 ++++++++++++++++++++++ Scenes/Levels/Systems/EffectsSystem.cs | 21 +++++++++++++-------- 4 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 Readme.md diff --git a/Components/Effect.cs b/Components/Effect.cs index 5335efe..cad3cfe 100644 --- a/Components/Effect.cs +++ b/Components/Effect.cs @@ -9,6 +9,7 @@ internal class Effect internal float Elapsed; public Vector2 Motion = Vector2.Zero; + public Vector2 TruePosition = Vector2.Zero; public bool Fadeout = false; diff --git a/NovemberPirates.sln b/NovemberPirates.sln index d7cefb8..972e04b 100644 --- a/NovemberPirates.sln +++ b/NovemberPirates.sln @@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitignore = .gitignore ArtExport.sh = ArtExport.sh .github\workflows\dotnet.yml = .github\workflows\dotnet.yml + Readme.md = Readme.md EndProjectSection EndProject Global diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..85d659e --- /dev/null +++ b/Readme.md @@ -0,0 +1,22 @@ +# November Pirates + +A Game for [Game of the Month 29 (November 2023)](https://itch.io/jam/one-game-a-month-29) + +# How to play + +Download the latest release from [the Releases](https://github.com/Nhawdge/November-Pirates/releases]. + +Extract the zip file and run the executable. + +Note: Windows will most likely be upset about knowing nothing of the executable, you can safely hit more info, and then run anyway. +If you don't trust me, you can also download the source code and run it yourself with `dotnet run` or `dotnet build` and then run the executable in the bin folder. + +## Controls + +* W/S will adjust the sails +* A/D Turns the ship +* Q/E Fires the cannons Port and Starboard respectively (Alternatively use left/right arrows) + +Special: +* F2 - Cycles through debug Mode +* F3 - Forces the wind to change (for debugging) diff --git a/Scenes/Levels/Systems/EffectsSystem.cs b/Scenes/Levels/Systems/EffectsSystem.cs index d43dba5..29af573 100644 --- a/Scenes/Levels/Systems/EffectsSystem.cs +++ b/Scenes/Levels/Systems/EffectsSystem.cs @@ -18,17 +18,22 @@ internal override void Update(World world) { var effect = effectEntity.Get(); var sprite = effectEntity.Get(); + if (effect.TruePosition == Vector2.Zero) + { + effect.TruePosition = sprite.Position; + } + effect.TruePosition += effect.Motion * Raylib.GetFrameTime(); if (effect.Wiggle) { - // TODO Figure this math out - var angle = Math.Atan2(effect.Motion.Y, effect.Motion.X); - var offset = new Vector2(); - var elapsed = effect.Elapsed; - offset.Y = Math.Abs((float)Math.Abs(Math.Sin(elapsed))); - var rotatedOffset = RayMath.Vector2Rotate(offset, (float)angle); - - sprite.Position += (effect.Motion + rotatedOffset) * Raylib.GetFrameTime(); + var truePosition = effect.TruePosition; + var direction = (float)Math.Atan2(effect.Motion.Y, effect.Motion.X); + + var offset = new Vector2((float)Math.Sin(effect.Elapsed) * 100, 0); + var rotatedOffset = RayMath.Vector2Rotate(offset, direction); + + sprite.Position = truePosition + rotatedOffset; + } else {