Exemple #1
0
        protected float yPos; //The y position of the prey, measured in the center

        #endregion Fields

        #region Constructors

        public Prey(float initialX, float initialY, Wyrm predator)
        {
            xPos = initialX;
            yPos = initialY;

            theWyrm = predator;

            basepoint = new Vector2(initialX, initialY + spriteHeight / 2);
            footpoint = new Vector2(initialX, initialY + preyheight / 2);
        }
Exemple #2
0
        //Constructor
        public WyrmPlayer()
        {
            //Create a Wyrm
            if (Game1.isTwoPlayer)
                theWyrm = new Wyrm(100, -3300);
            else
                theWyrm = new Wyrm(100, 450);

            stamina = staminaMax;
        }
Exemple #3
0
        public Barracks(int initialX, int initialY, Wyrm predator)
            : base(initialX, initialY, predator)
        {
            asSprite = new AnimatedSprite(buildingTextures[BARRACKS], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;

            boundingRadius = 25;

            hitPoints = BARRACKS_MAX_HIT_POINTS;

            buildingheight = BARRACKS_HEIGHT;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
        }
Exemple #4
0
        public OilDerrick(int x, int y, Wyrm predator)
            : base(x, y, predator)
        {
            asSprite = new AnimatedSprite(buildingTextures[OIL_DERRICK], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;
            asSprite.FrameLength = FRAME_LENGTH;

            boundingRadius = 25;

            hitPoints = OILDERRICK_MAX_HIT_POINTS;

            buildingheight = OIL_DERRICK_HEIGHT;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
        }
Exemple #5
0
        public Generator(int x, int y, Wyrm predator)
            : base(x, y, predator)
        {
            asSprite = new AnimatedSprite(buildingTextures[GENERATOR], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;
            asSprite.FrameLength = FRAME_LENGTH;

            hitPoints = GENERATOR_MAX_HIT_POINTS;

            boundingRadius = BOUNDING_RADIUS;

            buildingheight = GENERATOR_HEIGHT;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
        }
Exemple #6
0
        /// <summary>
        /// Building Constructor
        /// </summary>
        /// <param name="initialX">Initial X position of the building</param>
        /// <param name="initialY">Initial Y position of the building</param>
        /// <param name="predator">The Wyrm that attacks the building</param>
        public Building(int initialX, int initialY, Wyrm predator)
        {
            xPos = initialX;
            yPos = initialY;

            theWyrm = predator;

            basepoint = new Vector2(initialX, initialY + spriteHeight);
            footpoint = new Vector2(initialX, initialY + buildingheight);

            if (xPos <= 0)
                xPos = 1;
            if (xPos >= Game1.SCREENWIDTH - 100)
                xPos = Game1.SCREENWIDTH - 100;
        }
Exemple #7
0
        public Factory(int initialX, int initialY, Wyrm predator)
            : base(initialX, initialY, predator)
        {
            asSprite = new AnimatedSprite(buildingTextures[FACTORY], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;

            asSprite.FrameLength = FRAME_LENGTH;

            boundingRadius = 35;

            hitPoints = FACTORY_MAX_HIT_POINTS;

            buildingheight = FACTORY_HEIGHT;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
        }
Exemple #8
0
        /// <summary>
        /// A mine that the Wyrm will be punished for eating
        /// </summary>
        /// <param name="initialX">The initial X position of the mine</param>
        /// <param name="initialY">The initial Y position of the mine</param>
        /// <param name="predator">Not used in this class, but needed to inherit from Prey</param>
        public Mine(float initialX, float initialY, Wyrm predator, Texture2D explosionTex)
            : base(initialX, initialY, predator)
        {
            preyheight = PREY_HEIGHT;
            boundingRadius = BOUNDING_RADIUS;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
            meatReward = 0;

            asSprite = new AnimatedSprite(preyTextures[MINE], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;

            isMine = true;

            explosionTexture = explosionTex;
        }
Exemple #9
0
        /// <summary>
        /// A tank which will shoot the Wyrm very hard
        /// </summary>
        /// <param name="initialX">The initial X position of the tank</param>
        /// <param name="initialY">The initial Y position of the tank</param>
        /// <param name="predator">The wyrm that the tank will shoot at</param>
        public Tank(int initialX, int initialY, Wyrm predator)
            : base(initialX, initialY, predator)
        {
            preyheight = PREY_HEIGHT;
            boundingRadius = BOUNDING_RADIUS;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
            meatReward = MEAT_REWARD;

            asSprite = new AnimatedSprite(preyTextures[TANK], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, 0);
            asSprite.IsAnimating = false;

            if (Game1.m_random.NextDouble() < 0.5)
                xVel = -1;
            else
                xVel = 1;
        }
Exemple #10
0
        public Turret(int x, int y, Wyrm predator)
            : base(x, y, predator)
        {
            asSprite = new AnimatedSprite(buildingTextures[TURRET], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = false;
            asSprite.FrameLength = FRAME_LENGTH;

            hitPoints = TURRET_MAX_HIT_POINTS;

            buildingheight = TURRET_HEIGHT;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;

            boundingRadius = BOUNDING_RADIUS * TURRET_SPRITE_SCALING;

            turretShotInstance = turretShot.CreateInstance();
        }
Exemple #11
0
        float TIMETOCHANGEVEL; //11

        #endregion Fields

        #region Constructors

        public newTank(int initialX, int initialY, Wyrm predator)
            : base(initialX, initialY, predator)
        {
            preyheight = PREY_HEIGHT;
            boundingRadius = BOUNDING_RADIUS;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
            meatReward = MEAT_REWARD;

            asSprite = new AnimatedSprite(preyTextures[NEW_TANK], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;

            if (Game1.m_random.NextDouble() < 0.5)
                xVel = -1;
            else
                xVel = 1;

            TIMETOCHANGEVEL = (float) (Game1.m_random.NextDouble() * 12 + 2);
        }
Exemple #12
0
        /// <summary>
        /// A soldier equipped with a gun to combat the wyrm
        /// </summary>
        /// <param name="initialX">The initial X position of the soldier</param>
        /// <param name="initialY">The initial Y position of the soldier</param>
        /// <param name="predator">The wyrm for the soldier to shoot at</param>
        /// <param name="bulletTex"></param>
        public SoldierHuman(int initialX, int initialY, Wyrm predator)
            : base(initialX, initialY, predator)
        {
            preyheight = PREY_HEIGHT;
            boundingRadius = BOUNDING_RADIUS;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
            meatReward = MEAT_REWARD;

            asSprite = new AnimatedSprite(preyTextures[SOLDIER], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;

            if (Game1.m_random.NextDouble() < 0.5)
                xVel = -2;
            else
                xVel = 2;

            determineVelocityUnscared();
        }
Exemple #13
0
        /// <summary>
        /// An engineer which lays mines to trick the Wyrm
        /// </summary>
        /// <param name="initialX">The initial X location of the Engineer</param>
        /// <param name="initialY">The initial Y location of the Engineer</param>
        /// <param name="predator">The Wyrm which is looking to eat the Engineer</param>
        public Engineer(int initialX, int initialY, Wyrm predator)
            : base(initialX, initialY, predator)
        {
            preyheight = PREY_HEIGHT;         //Assign a value to the height of this prey
            boundingRadius = BOUNDING_RADIUS; //Assign a value to the bounding radius of this prey
            spriteHeight = SPRITEHEIGHT;
            spriteWidth = SPRITEWIDTH;

            meatReward = MEAT_AMOUNT;

            asSprite = new AnimatedSprite(preyTextures[MINE_LAYER], 0, 0, SPRITEWIDTH,  SPRITEHEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;

            if (Game1.m_random.NextDouble() < 0.5)
                xVel = -2;
            else
                xVel = 2;
            determineVelocityUnscared();

            mineLayTarget = MathHelper.Clamp((float)(Game1.m_random.NextDouble() * MAXTIMETOMINE), MINTIMETOMINE, MAXTIMETOMINE);
        }
Exemple #14
0
        /// <summary>
        /// A depth charge that the Wyrm will have to avoid while underground
        /// </summary>
        /// <param name="initialX">The initial X position of the depth charge</param>
        /// <param name="initialY">The initial Y position of the depth charge</param>
        /// <param name="predator">The wyrm which the depth charge wants to damage</param>
        /// <param name="explosionTex">The explosion texture which animates when the depth charge is destroyed</param>
        public DepthCharge(float initialX, float initialY, Wyrm predator, Texture2D explosionTex)
            : base(initialX, initialY, predator, explosionTex)
        {
            preyheight = PREY_HEIGHT;
            boundingRadius = BOUNDING_RADIUS;
            spriteHeight = SPRITE_HEIGHT;
            spriteWidth = SPRITE_WIDTH;
            meatReward = 0;

            asSprite = new AnimatedSprite(preyTextures[DEPTH_CHARGE], 0, 0, SPRITE_WIDTH, SPRITE_HEIGHT, NUM_FRAMES);
            asSprite.IsAnimating = true;

            isMine = true;

            explosionTexture = explosionTex;

            recalcPositions();
            footToGround();

            moveSpeed = (float) Game1.m_random.NextDouble() * 5 + 3;
        }
Exemple #15
0
        /// <summary>
        /// An animal that the Wyrm can eat
        /// </summary>
        /// <param name="initialX">The initial X position of the animal</param>
        /// <param name="initialY">The initial Y position of the animal</param>
        /// <param name="texture">The texture this animal uses</param>
        /// <param name="frames">The number of frames in the animal's animation</param>
        /// <param name="spriteHeight">The pixel height of the animal's sprite</param>
        /// <param name="spriteWidth">The pixel width of the animal's sprite</param>
        /// <param name="prHeight">The height of the animal in-game</param>
        /// <param name="boundingRadius">The bounding radius that the wyrm can eat the animal with</param>
        /// <param name="predator">The wyrm that the animal reacts to</param>
        /// <param name="meat">The amount of meat that this animal is worth</param>
        /// <param name="facingY">The Y position on the spritesheet which mirrors the sprite's facing</param>
        public Animal(int initialX, int initialY, Texture2D texture, int frames, int spHeight, int spWidth, int prHeight,
                      float bndRadius, Wyrm predator, int meat, int facingY)
            : base(initialX, initialY, predator)
        {
            spriteWidth = spWidth;
            spriteHeight = spHeight;
            preyheight = prHeight;
            boundingRadius = bndRadius;

            meatReward = meat;
            otherFacing = facingY;

            asSprite = new AnimatedSprite(texture, 0, 0, spriteWidth, spriteHeight, frames);
            asSprite.IsAnimating = true;

            otherFacing = facingY;

            if (Game1.m_random.NextDouble() < 0.5)
                xVel = -2;
            else
                xVel = 2;

            determineVelocityUnscared();
        }
Exemple #16
0
        //Constructor
        public HumanPlayer(WyrmPlayer otherPlayer)
        {
            theWyrm = otherPlayer.theWyrm;

            barracksLoc = new Vector2();
            factoryLoc = new Vector2();
            incomeIndicators = new List<FloatingText>();

            //Create the generator
            Building.buildings.Add(new Generator(Game1.m_random.Next(200, 1080), 330, theWyrm));

            buttons = new List<HUDElement>();

            //Turret button
            buttons.Add(new HUDElement(turretButtonTex, new Rectangle(TURRET_X, TURRET_Y, TURRETBUTTON_WIDTH, TURRETBUTTON_HEIGHT)));

            //Oil derrick button
            buttons.Add(new HUDElement(oilDerrickButtonTex, new Rectangle(OILDERRICK_X, OILDERRICK_Y, OILDERRICK_BUTTON_WIDTH, OILDERRICK_BUTTON_HEIGHT)));

            //Barracks button
            buttons.Add(new HUDElement(barracksButtonTex, new Rectangle(BARRACKS_X, BARRACKS_Y, BARRACKS_BUTTON_WIDTH, BARRACKS_BUTTON_HEIGHT)));

            //Soldier recruitment button
            buttons.Add(new HUDElement(soldierRecruitTex, new Rectangle(ADDTROOPS_X, ADDTROOPS_Y, ADDTROOPS_WIDTH, ADDTROOPS_HEIGHT)));

            //Engineer recruitment button
            buttons.Add(new HUDElement(engineerRecruitTex, new Rectangle(ADDENGINEER_X, ADDENGINEER_Y, ADDENGINEER_WIDTH, ADDENGINEER_HEIGHT)));

            //Factory button
            buttons.Add(new HUDElement(factoryButtonTex, new Rectangle(FACTORY_X, FACTORY_Y, FACTORY_BUTTON_WIDTH, FACTORY_BUTTON_HEIGHT)));

            //Tank recruitment button
            buttons.Add(new HUDElement(tankRecruitTex, new Rectangle(ADDTANK_X, ADDTANK_Y, ADDTANK_WIDTH, ADDTANK_HEIGHT)));

            //Disabled turret button
            buttons.Add(new HUDElement(disabledTurretButtonTex, new Rectangle(TURRET_X, TURRET_Y, TURRETBUTTON_WIDTH, TURRETBUTTON_HEIGHT)));

            //Disabled oil derrick button
            buttons.Add(new HUDElement(disabledOilDerrickButtonTex, new Rectangle(OILDERRICK_X, OILDERRICK_Y, OILDERRICK_BUTTON_WIDTH, OILDERRICK_BUTTON_HEIGHT)));

            //Disabled barracks button
            buttons.Add(new HUDElement(disabledBarracksButtonTex, new Rectangle(BARRACKS_X, BARRACKS_Y, BARRACKS_BUTTON_WIDTH, BARRACKS_BUTTON_HEIGHT)));

            //Disabled factory button
            buttons.Add(new HUDElement(disabledFactoryButtonTex, new Rectangle(FACTORY_X, FACTORY_Y, FACTORY_BUTTON_WIDTH, FACTORY_BUTTON_HEIGHT)));

            canClick = true;

            //Reset any static variables
            numOilDerricks = 0;
        }