/// <summary> /// Constructor for alien base /// </summary> /// <param name="imgName">image of the alien</param> /// <param name="prefMax">preferred maximum distance from target (usually firing range)</param> /// <param name="prefMin">preferred minimum distance from target</param> /// <param name="numShields">how many shield levels - how many hits to kill it (-1)</param> /// <param name="awareness">how distant an object can the alien detect to avoid</param> /// <param name="inaccuracy">how wide an angle (radians) around the target will the alien be willing to fire</param> public AlienBase(string imgName, int prefMax, int prefMin, int numShields, int awareness, float inaccuracy) : base(Utilities.getScreenEdge(), imgName, new Coordinates[] { new Coordinates(0, -(Image.FromFile(GameMedia.getDir[imgName]).Height / Settings.boundDivisor) / 2 * (float) 1.3), new Coordinates(-(Image.FromFile(GameMedia.getDir[imgName]).Width / Settings.boundDivisor) / 2, (Image.FromFile(GameMedia.getDir[imgName]).Height / Settings.boundDivisor) / 2), new Coordinates((Image.FromFile(GameMedia.getDir[imgName]).Width / Settings.boundDivisor) / 2, (Image.FromFile(GameMedia.getDir[imgName]).Height / Settings.boundDivisor) / 2) }) { Velocity.setVector((float).1, Position.getDirectionTo(Utilities.screenCenter)); RadRotation = Velocity.getDirection() + (float)Math.PI / 2; escaping = false; shieldLevel = numShields; preferredMaxDist = prefMax; preferredMinDist = prefMin; accelerating = false; hasBoomed = false; boom = new Explosions(); this.awareness = awareness; angleOfInaccuracy = inaccuracy; bullets = new List <Weapon>(); visibleObjs = new List <GameObject>(); bulletCoolDown = 200; // gives player time to see the alien before it shoots plusOrMinus = 1; canDodge = true; isCoward = false; cowardAngle = (float)Math.PI / 12; pointValue = 0; }
/// <summary> /// Constructor - Creates the vehicle /// </summary> /// <param name="initialX">X coordinate of vehicle</param> /// <param name="initialY">Y Coordinate of vehicle</param> public PlayerShip(int initialX, int initialY) : base((float)initialX, (float)initialY, 32, 32, "spaceShipPIC", new Coordinates[] { new Coordinates(0, -(32 / Settings.boundDivisor) / 2 * (float) 1.3), new Coordinates(-(32 / Settings.boundDivisor) / 2, (32 / Settings.boundDivisor) / 2), new Coordinates((32 / Settings.boundDivisor) / 2, (32 / Settings.boundDivisor) / 2) }) { Thrust = Settings.shipThrust; TurnRatio = Settings.shipTurnRatio; bullets = new List <Weapon>(); bulletCoolDown = 0; warpCoolDown = 0; hasBoomed = false; boom = new Explosions(); }
/// <summary> /// This is called by both constructors. /// </summary> private void initializeMeteor() { rotateRate = (float)(Utilities.rand.Next(20) - 10) / Settings.meteorSpin; boom = new Explosions(); }