Added more sound effects. Added initial weapon muzzle fire logic.
This commit is contained in:
20
AlientAttack.MonoGame/Things/Muzzles/MuzzleMath.cs
Normal file
20
AlientAttack.MonoGame/Things/Muzzles/MuzzleMath.cs
Normal 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
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user