Added configurable weapons.

This commit is contained in:
2026-01-03 21:49:27 -05:00
parent 79fd63c3ce
commit e8e31bb143
37 changed files with 332 additions and 88 deletions

View File

@@ -8,10 +8,11 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AlienAttack.MonoGame.Things;
internal enum PlayerHorizontalMoveState
public enum PlayerHorizontalMoveState
{
None,
Left,
@@ -19,7 +20,7 @@ internal enum PlayerHorizontalMoveState
}
[Flags]
internal enum MoveFlag
public enum MoveFlag
{
None = 0,
Left = 1,
@@ -34,7 +35,7 @@ public class DrwaState
}
internal class Player : MoveableSprite
public class Player : MoveableSprite
{
protected PlayerHorizontalMoveState MoveState = PlayerHorizontalMoveState.None;
protected MoveFlag MoveFlags;
@@ -61,10 +62,64 @@ internal class Player : MoveableSprite
{
BoundBox = new Rectangle(0, 0, 64, 64);
//ActiveWeapons.Add(new Minigun());
ActiveWeapons.Add(new MinigunTripleSpreadFast());
//ActiveWeapons.Add(new MinigunTripleSpreadFast());
//ActiveWeapons.Add(new MinigunSpread());
Health = 100;
Shield = 100;
// Weapon 1
WeaponDef weaponDef = new()
{
Name = "Weapon 1",
Bullet = BulletDefinitions.LaserLarge,
Pattern = ShotPatterns.TripleSpread,
FireSfxKey = ""
};
WeaponState weasponState = new()
{
FireThreshold = 15,
SpeedMultiplier = 1,
DamageBonus = 0
};
ConfigurableWeapon configurableWeapon = new(weaponDef, weasponState);
// Weapon 2
//WeaponDef weaponDef2 = new()
//{
// Name = "Weapon 2",
// Bullet = BulletDefinitions.MinigunSmall,
// Pattern = ShotPatterns.Single,
// FireSfxKey = ""
//};
//WeaponState weasponState2 = new()
//{
// FireThreshold = 20,
// SpeedMultiplier = 2f,
// DamageBonus = 0
//};
//ConfigurableWeapon configurableWeapon2 = new(weaponDef2, weasponState2);
ActiveWeapons.Add(configurableWeapon);
//ActiveWeapons.Add(configurableWeapon2);
}
public Vector2 GetMuzzleLocal(MuzzleId muzzle)
{
switch (muzzle)
{
case MuzzleId.Center:
return Muzzles[0].LocalPx;
case MuzzleId.Left:
return Muzzles[1].LocalPx;
case MuzzleId.Right:
return Muzzles[2].LocalPx;
}
return new();
}
//Texture2D texture = Game