Updated weapon logic. Fixed player CheckMove logic.

This commit is contained in:
2026-08-24 19:46:04 -04:00
parent c1124a784d
commit e42b11c6fc
10 changed files with 279 additions and 73 deletions

View File

@@ -36,7 +36,7 @@ public record DrawState
public SpriteEffects SpriteEffects { get; init; }
}
public class Player : MoveableSprite
public class Player : Ship
{
protected PlayerHorizontalMoveState MoveState = PlayerHorizontalMoveState.None;
protected MoveFlag MoveFlags;
@@ -125,7 +125,7 @@ public class Player : MoveableSprite
//ActiveWeapons.Add(configurableWeapon2);
}
public Vector2 GetMuzzleLocal(MuzzleId muzzle)
public override Vector2 GetMuzzleLocal(MuzzleId muzzle)
{
switch (muzzle)
{
@@ -283,24 +283,24 @@ public class Player : MoveableSprite
XVelocity *= 1.5f;
}
if (XPosition < 0)
if (XPosition - Origin.X < 0)
{
XPosition = 0;
XPosition = 0 + Origin.X;
}
if (XPosition + BoundBox.Width > context.ViewTransform.ScreenWidth)
if (XPosition + BoundBox.Width - Origin.X > context.ViewTransform.ScreenWidth)
{
XPosition = context.ViewTransform.ScreenWidth - BoundBox.Width;
XPosition = context.ViewTransform.ScreenWidth - BoundBox.Width + Origin.X;
}
if (YPosition < 0)
if (YPosition - Origin.Y < 0)
{
YPosition = 0;
YPosition = 0 + Origin.Y;
}
if (YPosition + BoundBox.Height > context.ViewTransform.ScreenHeight)
if (YPosition + BoundBox.Height - Origin.Y > context.ViewTransform.ScreenHeight)
{
YPosition = context.ViewTransform.ScreenHeight - BoundBox.Height;
YPosition = context.ViewTransform.ScreenHeight - BoundBox.Height + Origin.Y;
}
}