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; }
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; }
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; }
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; }
float yPos; // y position of the bullet #endregion Fields #region Constructors public Bullet(float initialX, float initialY, Vector2 velocity, Texture2D texture, int frames, int spriteheight, int spritewidth, float boundingradius, int dam) { xPos = initialX; yPos = initialY; vel = velocity; bulletTexture = texture; damage = dam; spriteWidth = spritewidth; spriteHeight = spriteheight; asprite = new AnimatedSprite(bulletTexture, 0, 0, spriteWidth, spriteHeight, frames); asSprite.IsAnimating = true; asSprite.fFrameRate = 0.05f; }
/// <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; }
/// <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; }
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(); }
public Explosion(float x, float y, Texture2D texture, bool mineExplosion) { xPos = x; yPos = y; if (mineExplosion) { yOff = 390; } else { yOff = 0; } asSprite = new AnimatedSprite(texture, 0, yOff, SPRITEWIDTH, SPRITEHEIGHT, 16); asSprite.FrameLength = 0.05f; }
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); }
/// <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(); }
/// <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); }
/// <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; }
/// <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(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { //DEBUG debugCircle = Content.Load<Texture2D>(@"Textures\debugCircleTex"); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); titleFont = Content.Load<SpriteFont>(@"Fonts\Title"); upgradeFont = Content.Load<SpriteFont>(@"Fonts\Upgrade"); upgradeFontNumbers = Content.Load<SpriteFont>(@"Fonts\upgradeFontNumbers"); scoreFont = Content.Load<SpriteFont>(@"Fonts\scoreFont"); blueBoxTitleScreen = Content.Load<Texture2D>(@"Textures\blueBox"); t2dTitleScreen = Content.Load<Texture2D>(@"Textures\titleScreen"); t2dTitleScreenNoWords = Content.Load<Texture2D>(@"Textures\titlescreen_no_words"); t2dtransparentBlack = Content.Load<Texture2D>(@"Textures\transparentBlack"); t2dupgradeBox = Content.Load<Texture2D>(@"Textures\wordbubble"); t2dupgradeBoxOffColor = Content.Load<Texture2D>(@"Textures\wordbubble_offcolor"); t2dupgradeArrow = Content.Load<Texture2D>(@"Textures\arrow"); HumanPlayer.LoadContent(Content); Prey.LoadContent(Content); Building.LoadContent(Content); FloatingText.LoadContent(Content); roar = Content.Load<SoundEffect>(@"Sounds\Predator Roar"); missileDown = Content.Load<SoundEffect>(@"Sounds\Missile"); missileDownInstance = missileDown.CreateInstance(); explosion = Content.Load<SoundEffect>(@"Sounds\explosion"); bgm = Content.Load<Song>(@"Sounds\Pizza"); WyrmPlayer.LoadContent(Content); t2dbackgroundSinglePlayer = Content.Load<Texture2D>(@"Textures\background"); t2dforegroundSinglePlayer = Content.Load<Texture2D>(@"Textures\foreground"); t2dbackgroundTwoPlayer = Content.Load<Texture2D>(@"Textures\2pbackground"); t2dforegroundTwoPlayer = Content.Load<Texture2D>(@"Textures\2pforeground"); explosionTexture = Content.Load<Texture2D>(@"Textures\explosions"); bulletTexture = Content.Load<Texture2D>(@"Textures\bullet"); cannonballTexture = Content.Load<Texture2D>(@"Textures\cannonball"); //Initialize the sprites which appear in the title/instruction screens tempGiraffe = new AnimatedSprite(Prey.preyTextures[Prey.GIRAFFE], 0, 0, 102, 95, 4); tempGiraffe.IsAnimating = true; tempElephant = new AnimatedSprite(Prey.preyTextures[Prey.ELEPHANT], 0, 0, 93, 71, 6); tempElephant.IsAnimating = true; tempUnarmed = new AnimatedSprite(Prey.preyTextures[Prey.UNARMEDHUMAN], 0, 0, 21, 24, 4); tempUnarmed.IsAnimating = true; tempSoldier = new AnimatedSprite(Prey.preyTextures[Prey.SOLDIER], 0, 27, 20, 25, 6); tempSoldier.IsAnimating = true; tempEngineer = new AnimatedSprite(Prey.preyTextures[Prey.MINE_LAYER], 0, 25, 25, 23, 6); tempEngineer.IsAnimating = true; tempMine = new AnimatedSprite(Prey.preyTextures[Prey.MINE], 0, 0, 16, 9, 3); tempTank = new AnimatedSprite(Prey.preyTextures[Prey.NEW_TANK], 0, 300, 75, 60, 3); tempTank.IsAnimating = true; MediaPlayer.IsRepeating = true; MediaPlayer.Play(bgm); SoundEffect.MasterVolume = SoundEffect.MasterVolume * 0.7f; }