Esempio n. 1
0
        public Trap(int initialX, int initialY, Texture2D texture, int frames, int spriteHeight, int spriteWidth, int preyHeight,
                    float boundingRadius, Wyrm predator, float damagedone, Texture2D explosionTex)
            : base(initialX, initialY, texture, frames, spriteHeight, spriteWidth, preyHeight, boundingRadius, predator, 0, 0)
        {
            asSprite = new AnimatedSprite(texture, 0, 0, spriteWidth, spriteHeight, frames);
            asSprite.IsAnimating = true;

            isMine = true;

            damageDone = damagedone;

            explosionTexture = explosionTex;
        }
Esempio n. 2
0
        public Vehicle(int initialX, int initialY, Texture2D texture, int frames, int spriteHeight, int spriteWidth, int preyHeight,
                    float boundingRadius, Wyrm predator, int meat, int facingY, Texture2D bulletTex)
            : base(initialX, initialY, texture, frames, spriteHeight, spriteWidth, preyHeight, boundingRadius, predator, meat, facingY)
        {
            asSprite = new AnimatedSprite(texture, 0, 0, 145, 50, 0);
            asSprite.IsAnimating = false;

            otherFacing = facingY;

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

            bulletTexture = bulletTex;
        }
Esempio n. 3
0
        int yPos; // y position of the bullet

        #endregion Fields

        #region Constructors

        public Bullet(int initialX, int 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;
        }
Esempio n. 4
0
        public Animal(int initialX, int initialY, Texture2D texture, int frames, int spriteHeight, int spriteWidth, int preyHeight,
                      float boundingRadius, Wyrm predator, bool isHuman, int meat, int facingY)
            : base(initialX, initialY, texture, frames, spriteHeight, spriteWidth, preyHeight, boundingRadius, predator, meat, facingY)
        {
            asSprite = new AnimatedSprite(preyTexture, 0, 0, spritewidth, spriteheight, animationFrames);
            asSprite.IsAnimating = true;

            human = isHuman;

            otherFacing = facingY;

            if (Game1.m_random.NextDouble() < 0.5)
                xVel = -1;
            else
                xVel = 1;
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
        public SoldierHuman(int initialX, int initialY, Texture2D texture, int frames, int spriteHeight, int spriteWidth, int preyHeight,
                    float boundingRadius, Wyrm predator, int meat, int facingY, int shootingLeftY, int shootingRightY, Texture2D bulletTex)
            : base(initialX, initialY, texture, frames, spriteHeight, spriteWidth, preyHeight, boundingRadius, predator, meat, facingY)
        {
            asSprite = new AnimatedSprite(texture, 0, 0, spriteWidth, spriteHeight, frames);
            asSprite.IsAnimating = true;

            otherFacing = facingY;

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

            shootingRightFacingY = shootingRightY;
            shootingLeftFacingY = shootingLeftY;

            bulletTexture = bulletTex;
        }
Esempio n. 7
0
        public Engineer(int initialX, int initialY, Texture2D texture, int frames, int spriteHeight, int spriteWidth, int preyHeight,
                    float boundingRadius, Wyrm predator, int meat, int facingY, int mineLeftY, int mineRightY, Texture2D mineTex)
            : base(initialX, initialY, texture, frames, spriteHeight, spriteWidth, preyHeight, boundingRadius, predator, meat, facingY)
        {
            asSprite = new AnimatedSprite(texture, 0, 0, spriteWidth, spriteHeight, frames);
            asSprite.IsAnimating = true;

            otherFacing = facingY;

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

            mineRightFacingY = mineRightY;
            mineLeftFacingY = mineLeftY;

            mineTexture = mineTex;

            mineLayTarget = MathHelper.Clamp((float)(Game1.m_random.NextDouble() * MAXTIMETOMINE), MINTIMETOMINE, MAXTIMETOMINE);
        }
Esempio n. 8
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // 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");
            scoreFont = Content.Load<SpriteFont>(@"Fonts\scoreFont");

            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");
            t2dupgradeArrow = Content.Load<Texture2D>(@"Textures\arrow");

            roar = Content.Load<SoundEffect>(@"Sounds\Predator Roar");
            chomp = Content.Load<SoundEffect>(@"Sounds\aud_chomp");
            explosion = Content.Load<SoundEffect>(@"Sounds\explosion");
            gunShot = Content.Load<SoundEffect>(@"Sounds\soldierShot");
            tankShot = Content.Load<SoundEffect>(@"Sounds\tankShot");

            bgm = Content.Load<Song>(@"Sounds\bgm");
            bgm2 = Content.Load<Song>(@"Sounds\bgm2");
            bgm3 = Content.Load<Song>(@"Sounds\bgm3");

            t2dWyrmHead = Content.Load<Texture2D>(@"Textures\wyrmHeadRed");
            t2dWyrmSeg = Content.Load<Texture2D>(@"Textures\wyrmSegRed");
            t2dWyrmTail = Content.Load<Texture2D>(@"Textures\wyrmTailRed");

            healthBase = Content.Load<Texture2D>(@"Textures\hb_red");
            health = Content.Load<Texture2D>(@"Textures\hb_green");
            stamina = Content.Load<Texture2D>(@"Textures\hb_yellow");
            regenBar = Content.Load<Texture2D>(@"Textures\hb_orange");

            bulletTexture = Content.Load<Texture2D>(@"Textures\bullet");
            cannonballTexture = Content.Load<Texture2D>(@"Textures\cannonball");

            t2dbackground = Content.Load<Texture2D>(@"Textures\background");
            t2dforeground = Content.Load<Texture2D>(@"Textures\foreground");

            preyTextures = new List<Texture2D>();
            preyTextures.Add(Content.Load<Texture2D>(@"Textures\giraffe"));
            preyTextures.Add(Content.Load<Texture2D>(@"Textures\elephant"));
            preyTextures.Add(Content.Load<Texture2D>(@"Textures\unarmed"));
            preyTextures.Add(Content.Load<Texture2D>(@"Textures\soldier"));
            preyTextures.Add(Content.Load<Texture2D>(@"Textures\mine_layer"));
            preyTextures.Add(Content.Load<Texture2D>(@"Textures\tank"));
            preyTextures.Add(Content.Load<Texture2D>(@"Textures\mine"));

            explosionTexture = Content.Load<Texture2D>(@"Textures\explosions");

            //Initialize the sprites which appear in the title/instruction screens
            tempGiraffe = new AnimatedSprite(preyTextures[GIRAFFE], 0, 0, 102, 95, 4);
            tempGiraffe.IsAnimating = true;
            tempElephant = new AnimatedSprite(preyTextures[ELEPHANT], 0, 0, 93, 71, 6);
            tempElephant.IsAnimating = true;

            tempUnarmed = new AnimatedSprite(preyTextures[UNARMEDHUMAN], 0, 0, 21, 24, 4);
            tempUnarmed.IsAnimating = true;
            tempSoldier = new AnimatedSprite(preyTextures[SOLDIER], 0, 27, 20, 25, 6);
            tempSoldier.IsAnimating = true;

            tempEngineer = new AnimatedSprite(preyTextures[MINE_LAYER], 0, 25, 25, 23, 6);
            tempEngineer.IsAnimating = true;
            tempMine = new AnimatedSprite(preyTextures[MINE], 0, 0, 16, 9, 3);

            tempTank = new AnimatedSprite(preyTextures[TANK], 0, 50, 145, 50, 0);
            tempTank.IsAnimating = false;

            MediaPlayer.IsRepeating = true;
            MediaPlayer.Play(bgm);
            bgm1Playing = true;
        }