Added more sound effects. Added initial weapon muzzle fire logic.

This commit is contained in:
2026-01-02 00:54:09 -05:00
parent c4a98ce03d
commit df45203227
43 changed files with 459 additions and 30 deletions

View File

@@ -0,0 +1,9 @@
using Microsoft.Xna.Framework;
namespace AlienAttack.MonoGame.Things.Muzzles;
public readonly struct Muzzle(MuzzleId id, Vector2 localPx)
{
public MuzzleId Id { get; } = id;
public Vector2 LocalPx { get; } = localPx;
}

View File

@@ -0,0 +1,8 @@
namespace AlienAttack.MonoGame.Things.Muzzles;
public enum MuzzleId
{
Center,
Left,
Right
}

View File

@@ -0,0 +1,20 @@
using Microsoft.Xna.Framework;
namespace AlienAttack.MonoGame.Things.Muzzles;
public static class MuzzleMath
{
public static Vector2 GetMuzzleWorld(Sprite owner, Vector2 muzzleLocalPx, float ownerScale = 1f)
{
// Assumes owner.Position is the top-left of the sprite
return owner.Position + muzzleLocalPx * ownerScale;
}
public static Vector2 CenterBulletOn(Vector2 muzzleWorld, int bulletW, int bulletH)
{
return new Vector2(
muzzleWorld.X - bulletW / 2f,
muzzleWorld.Y - bulletH / 2f
);
}
}