Skip to content

Commit

Permalink
Mid work commit, because this actually looks okay
Browse files Browse the repository at this point in the history
  • Loading branch information
Nhawdge committed Nov 7, 2023
1 parent 7d0dfe9 commit 28962d3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
1 change: 1 addition & 0 deletions Components/Effect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal class Effect
internal float Elapsed;

public Vector2 Motion = Vector2.Zero;
public Vector2 TruePosition = Vector2.Zero;

public bool Fadeout = false;

Expand Down
1 change: 1 addition & 0 deletions NovemberPirates.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -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)
21 changes: 13 additions & 8 deletions Scenes/Levels/Systems/EffectsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ internal override void Update(World world)
{
var effect = effectEntity.Get<Effect>();
var sprite = effectEntity.Get<Sprite>();
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
{
Expand Down

0 comments on commit 28962d3

Please sign in to comment.