Skip to content

Commit

Permalink
mouse y invert
Browse files Browse the repository at this point in the history
  • Loading branch information
danilwhale committed Jul 16, 2024
1 parent 5aabdac commit 5af1b5e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion SharpCraft/Entities/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ public sealed class Player(PlayerEntity entity, WorldRenderer worldRenderer, Par
{
public byte CurrentTile = 1;
private RayCollision _rayCast;
private int _pitchFactor = 1;

public void Update()
{
var mouseDelta = GetMouseDelta();
entity.Rotate(mouseDelta.Y, -mouseDelta.X);
entity.Rotate(mouseDelta.Y * _pitchFactor, -mouseDelta.X);

_rayCast = entity.World.DoRayCast(entity.Camera.GetForwardRay(), 4.0f);

Expand Down Expand Up @@ -48,6 +49,11 @@ public void Update()
{
entity.System?.Add(new ZombieEntity(entity.World, entity.Position));
}

if (IsKeyPressed(KeyboardKey.Y))
{
_pitchFactor *= -1;
}
}

public void Draw()
Expand Down

0 comments on commit 5af1b5e

Please sign in to comment.