//constructor /// <summary> /// creates instance of bullet facing gun's direction at time of it firing /// </summary> /// <param name="bulletDirection">gun's direction at time of firing bullet</param> public BasicGunBullet(WeaponDirection bulletDirection, Point gunLocation, Texture2D bulletTexture) { //create bullet collusion as a 4 by 4 square bulletCircle.X = gunLocation.X; bulletCircle.Y = gunLocation.Y; bulletCircle.Radius = 1; this.bulletDirection = bulletDirection; this.bulletTexture = bulletTexture; bulletTextureWidth = bulletTexture.Width / 4; bulletTextureHeight = bulletTexture.Height; bulletAnimationFrame = 0; distanceTraveled = 0; }
//input rise as if the bullet is being shot to the RIGHT public ShotgunBullet(WeaponDirection direction, Point gunlocation, int rise, Texture2D bulletTexture) { bulletcircle = new Circle(gunlocation.X, gunlocation.Y, 4); trajectory.Y = rise; trajectory.X = bulletspeed; this.direction = direction; distanceTraveled = 0; this.bulletTexture = bulletTexture; bulletTextureWidth = bulletTexture.Width / 4; bulletTextureHeight = bulletTexture.Height; bulletAnimationFrame = 0; }
//Constructor /// <summary> /// Creates instance of weapon with given stats /// These are the base stat that all weapons will have /// </summary> /// <param name="name">Name of weapon</param> /// <param name="weaponType">an enum saying if the weapon is a melee, gun, or bomb</param> /// <param name="damage">Amount of damage the weapon deals in one hit</param> /// <param name="range">How far the weapon can damage in pixels</param> /// <param name="cooldownTime">How much time in seconds that the weapon must rest between attacks</param> /// <param name="attackPhaseDurationTime">How long the attack phase takes in seconds</param> /// <param name="WeaponSpawnLocation">Where the weapon should spawn at first creation</param> public WeaponAbstract(string name, TypeOfWeapon weaponType, int damage, int range, float cooldownTime, float attackPhaseDurationTime, Rectangle WeaponSpawnLocation, Texture2D uITexture) { //weapon stats this.name = name; this.weaponType = weaponType; this.damage = damage; this.range = range; this.cooldownTime = cooldownTime; this.attackPhaseDurationTime = attackPhaseDurationTime; //needed to make Update and Attacking, and Draw methods work TimeThatHasPassed = 0; IsAttacking = false; location = new Point(WeaponSpawnLocation.X, WeaponSpawnLocation.Y); weaponFacing = WeaponDirection.Up; this.uITexture = uITexture; }
public RocketLauncherBullet(WeaponDirection bulletDirection, Point gunLocation, Texture2D bulletTexture, Texture2D explosion, int radius) { explosionRange = radius; bulletCircle = new Circle(gunLocation.X, gunLocation.Y, 8); this.bulletDirection = bulletDirection; bulletspeed = 7; this.bulletTexture = bulletTexture; explosionTexture = explosion; explosionTime = 40; readyToBeRemoved = false; exploding = false; distanceTraveled = 0; bulletAnimationFrame = 0; if (bulletDirection == WeaponDirection.Down) { rotation = 1.57f; xOffset = 80; yOffset = -90; } else if (bulletDirection == WeaponDirection.Left) { rotation = 3.14f; xOffset = 25; yOffset = 80; } else if (bulletDirection == WeaponDirection.Up) { rotation = 4.71f; xOffset = -80; yOffset = 25; } //facing right else { rotation = 0f; xOffset = -50; yOffset = -80; } }