Ejemplo n.º 1
0
        public override void LoadContent()
        {
            minusTex    = Content.Load <Texture2D>("Textures/Options/Minus");
            plusTex     = Content.Load <Texture2D>("Textures/Options/Plus");
            medTex      = Content.Load <Texture2D>("Textures/Options/Med");
            lowTex      = Content.Load <Texture2D>("Textures/Options/Low");
            mediumTex   = Content.Load <Texture2D>("Textures/Options/Medium");
            highTex     = Content.Load <Texture2D>("Textures/Options/High");
            triangleTex = Content.Load <Texture2D>("Textures/Menu/TriangleMan");

            buttonMinus = new Button(minusTex, new Vector2(-35 + minusTex.Width, 215 + minusTex.Height), Resources.ColorHighLight, Button.ButtonType.VolumeControl, 0);
            buttonPlus  = new Button(plusTex, new Vector2(xOffset + buttonMinus.getPosX() + minusTex.Width, buttonMinus.getPosY()), Resources.ColorHighLight, Button.ButtonType.VolumeControl, 1);
            buttonMed   = new Button(medTex, new Vector2(xOffset + buttonPlus.getPosX() + minusTex.Width, buttonMinus.getPosY()), Resources.ColorHighLight, Button.ButtonType.VolumeControl, 2);

            buttonLow    = new Button(lowTex, new Vector2(-35 + lowTex.Width, 375 + lowTex.Height), Resources.ColorHighLight, Button.ButtonType.GraphicsControl, 0);
            buttonMedium = new Button(mediumTex, new Vector2(xOffset + buttonLow.getPosX() + lowTex.Width, 375 + lowTex.Height), Resources.ColorHighLight, Button.ButtonType.GraphicsControl, 1);
            buttonHigh   = new Button(highTex, new Vector2(xOffset + buttonMedium.getPosX() + lowTex.Width, 375 + lowTex.Height), Resources.ColorHighLight, Button.ButtonType.GraphicsControl, 2);

            sTriangle = new Sprite3(true, triangleTex, 0, 0);
            sTriangle.setHSoffset(new Vector2(triangleTex.Width / 2, triangleTex.Height / 2));
            sTriangle.setPos(new Vector2(675, 305));

            title        = "Options:";
            subtitle     = "Adjust to Your Hearts Content";
            instructions = "Press Any Key to Return to Main Menu";
            displayGraphicsQuality();
        }
Ejemplo n.º 2
0
        public override void LoadContent()
        {
            // Load Textures
            continueTex  = Content.Load <Texture2D>("Textures/Menu/Continue");
            optionsTex   = Content.Load <Texture2D>("Textures/Menu/Options");
            howToPlayTex = Content.Load <Texture2D>("Textures/Menu/HowToPlay");
            exitTex      = Content.Load <Texture2D>("Textures/Menu/Exit");
            titleTex     = Content.Load <Texture2D>("Textures/Menu/Title");
            triangleTex  = Content.Load <Texture2D>("Textures/Menu/TriangleMan");
            newgameTex   = Content.Load <Texture2D>("Textures/Menu/NewGame");
            hexagonTex   = Content.Load <Texture2D>("Textures/Menu/HexagonGuy");

            // Create sprites for title and display characters
            sTitle    = new Sprite3(true, titleTex, 0, 0);
            sTriangle = new Sprite3(true, triangleTex, 0, 0);

            // Set sprite offsets
            sTitle.setHSoffset(new Vector2(titleTex.Width / 2, titleTex.Height / 2));
            sTriangle.setHSoffset(new Vector2(triangleTex.Width / 2, triangleTex.Height / 2));

            // Set Position of Sprites
            sTitle.setPos(new Vector2(xAligned, 0 + sTitle.getHeight()));
            sTriangle.setPos(675, 275);

            buttonNewGame   = new Button(newgameTex, new Vector2(xAligned, (95 + sTitle.getPosY()) + (newgameTex.Height)), Resources.ColorHighLight, Button.ButtonType.ResetGame, 0);
            buttonContinue  = new Button(continueTex, new Vector2(xAligned, buttonNewGame.getPosY() + (minorOffset + continueTex.Height)), Resources.ColorHighLight, Button.ButtonType.ChangeLevelSet, Resources.currPlayLevel);
            buttonOptions   = new Button(optionsTex, new Vector2(xAligned, buttonContinue.getPosY() + (minorOffset + optionsTex.Height)), Resources.ColorHighLight, Button.ButtonType.ChangeLevelSet, 5);
            buttonHowToPlay = new Button(howToPlayTex, new Vector2(xAligned, buttonOptions.getPosY() + (minorOffset + howToPlayTex.Height)), Resources.ColorHighLight, Button.ButtonType.ChangeLevelPush, 8);
            buttonExit      = new Button(exitTex, new Vector2(xAligned, buttonHowToPlay.getPosY() + (minorOffset + exitTex.Height)), Resources.ColorHighLight, Button.ButtonType.Exit, 0);
            buttonHighScore = new Button(hexagonTex, new Vector2(135, 339), Resources.ColorLose, Button.ButtonType.ChangeLevelSet, 13);
        }
Ejemplo n.º 3
0
 public override void LoadContent()
 {
     transparency = new ColorField(new Color(Color.Black, 0.5f), new Rectangle(0, 0, (int)Game1.screenSize.X, (int)Game1.screenSize.Y));
     displayTex   = Content.Load <Texture2D>("Textures/Menu/HowToPlayScreen");
     display      = new Sprite3(true, displayTex, 0, 0);
     display.setHSoffset(new Vector2(displayTex.Width / 2, displayTex.Height / 2));
     display.setPos(Game1.screenSize / 2);
 }
Ejemplo n.º 4
0
 // Basic Sprite Constructor
 public SpriteActor(Texture2D tex, Vector2 position, Vector2 velocity)
 {
     spriteSize    = new Vector2(tex.Width, tex.Height);
     this.position = position;
     this.velocity = velocity;
     sprite        = new Sprite3(true, tex, position.X - tex.Width, position.Y - tex.Height);
     sprite.setHSoffset(new Vector2(spriteSize.X / 2, spriteSize.Y / 2));
     sprite.setBBToTexture();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Create a basic button
 /// </summary>
 /// <param name="tex">Button texture</param>
 /// <param name="pos">Position</param>
 /// <param name="highLight">Highlighted colour</param>
 /// <param name="buttonType">Button type</param>
 /// <param name="nextLevel">nextlevel/value if applicable</param>
 public Button(Texture2D tex, Vector2 pos, Color highLight, ButtonType buttonType, int nextLevel)
 {
     // Initialise our Button
     this.highLight = highLight;
     this.nextLevel = nextLevel;
     type           = buttonType;
     button         = new Sprite3(true, tex, 0, 0);
     button.setHSoffset(new Vector2(button.getWidth() / 2, button.getHeight() / 2));
     button.setPos(pos);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            LineBatch.init(GraphicsDevice);

            // load all fonts for the splash screen and levels
            llFont = Content.Load <SpriteFont>("Large");
            mmFont = Content.Load <SpriteFont>("Medium");
            ssFont = Content.Load <SpriteFont>("Small");

            // load  textures from local content directory
            kcTexPath   = @"/Users/jfc/Desktop/CrazyCat_Assignment_GPT/GPT_Assignment/GPT_Assignment/Content/kittyCat.png";
            kittyCatTex = Util.texFromFile(GraphicsDevice, kcTexPath);

            bbTexPath     = @"/Users/jfc/Desktop/CrazyCat_Assignment_GPT/GPT_Assignment/GPT_Assignment/Content/Background.png";
            backgroundTex = Util.texFromFile(GraphicsDevice, bbTexPath);

            playerTexPath = @"/Users/jfc/Desktop/CrazyCat_Assignment_GPT/GPT_Assignment/GPT_Assignment/Content/KittyCatFrames.png";
            playerTex     = Util.texFromFile(GraphicsDevice, playerTexPath);

            doggyTexPath = @"/Users/jfc/Desktop/CrazyCat_Assignment_GPT/GPT_Assignment/GPT_Assignment/CrazyDogFrames.png";
            doggyTex     = Util.texFromFile(GraphicsDevice, doggyTexPath);

            yarnTex = Content.Load <Texture2D>("Yarn");

            // position vector for the cat sprite on main splash screen
            kittyCatVec   = new Vector2(275, 50);
            titleVec      = new Vector2(100, 300);
            sloganVec     = new Vector2(290, 400);
            instructVec   = new Vector2(315, 425);
            levelIntroVec = new Vector2(250, 200);
            playerVec     = new Vector2(600, 400);
            doggyVec      = new Vector2(0, 400);


            // make the cat sprite for the main splash screen
            kittyCat = new Sprite3(true, kittyCatTex, kittyCatVec.X, kittyCatVec.Y);

            // prepare the crazy dog for level 2
            crazyDog = new Sprite3(false, doggyTex, doggyVec.X, doggyVec.Y);



            // color for the level text and alpha value
            ltCol = new Color(0, 255, 0, 1);
            // level text initialization
            levelText = new TextRenderable("Blabla", levelIntroVec, llFont, Color.Red);


            // source and destination rectangles for the scrolling background
            backgroundDest   = new Rectangle(0, 0, 800, 600);
            backgroundSource = new Rectangle(0, 0, 800, 600);

            // draw background
            background = new ScrollBackGround(backgroundTex, backgroundDest, backgroundSource, 5.0f, 2);

            // player vector and player texture

            playerSprite = new Sprite3(true, playerTex, playerVec.X, playerVec.Y);

            // initialize frame vector
            playerFrames = new Vector2[10];

            // frame vector values 1280x128

            playerFrames[0].X = 0; playerFrames[0].Y = 0;
            playerFrames[1].X = 1; playerFrames[1].Y = 0;
            playerFrames[2].X = 2; playerFrames[2].Y = 0;
            playerFrames[3].X = 3; playerFrames[3].Y = 0;
            playerFrames[4].X = 4; playerFrames[4].Y = 0;
            playerFrames[5].X = 5; playerFrames[5].Y = 0;
            playerFrames[6].X = 6; playerFrames[6].Y = 0;
            playerFrames[7].X = 7; playerFrames[7].Y = 0;
            playerFrames[8].X = 8; playerFrames[8].Y = 0;
            playerFrames[9].X = 9; playerFrames[9].Y = 0;

            // set all the parameters for the cute little kitty cat
            playerSprite.setWidthHeight(64, 64);
            playerSprite.setWidthHeightOfTex(1280, 128);
            playerSprite.setXframes(10);
            playerSprite.setYframes(0);
            playerSprite.setBB(0, 0, 128, 128);
            playerSprite.setAnimationSequence(playerFrames, 0, 9, 15);
            playerSprite.animationStart();

            // the parameters for the player sprite jumping
            playerJump      = false;
            playerJumpSpeed = 0;

            // store the initial positions of the player sprite
            prevPos.Y = playerVec.Y;
            prevPos.X = playerVec.X;

            // initialize sounds for the game
            jumpo      = Content.Load <SoundEffect>("Sounds/Boing");
            jumpoSound = new LimitSound(jumpo, 1);

            success      = Content.Load <SoundEffect>("Sounds/Success");
            successSound = new LimitSound(success, 1);

            barko      = Content.Load <SoundEffect>("Sounds/Growl");
            barkoSound = new LimitSound(barko, 1);

            kaching      = Content.Load <SoundEffect>("Sounds/Kaching");
            kachingSound = new LimitSound(kaching, 1);

            yowlin      = Content.Load <SoundEffect>("Sounds/Yowl");
            yowlinSound = new LimitSound(yowlin, 1);

            easterEgg = Content.Load <SoundEffect>("Sounds/OhWhatever");
            eeSound   = new LimitSound(easterEgg, 1);


            /// yarn ball sprite list
            ///
            ///
            ///
            ///
            ///
            ///

            yarnBalls = new SpriteList();

            Sprite3 yb;

            for (int i = 0; i < maxYarnBalls; i++)
            {
                // temporarily set to doggyVec for positioning - change later?
                yb = new Sprite3(true, yarnTex, doggyVec.X + i * 50, doggyVec.Y - i * 50);
                yb.setDeltaSpeed(new Vector2((float)(1 + rnd.NextDouble()), 0));
                yb.setWidthHeight(32, 32);
                yb.setWidthHeightOfTex(32, 32);
                yb.setHSoffset(new Vector2(32, 32));
                yb.setBBToTexture();
                yb.setMoveSpeed(2.1f);

                yarnBalls.addSpriteReuse(yb);
            }



            // initialize frame vector for dog
            doggyFrames = new Vector2[8];


            doggyFrames[0].X = 0; doggyFrames[0].Y = 0;
            doggyFrames[1].X = 1; doggyFrames[1].Y = 0;
            doggyFrames[2].X = 2; doggyFrames[2].Y = 0;
            doggyFrames[3].X = 3; doggyFrames[3].Y = 0;
            doggyFrames[4].X = 4; doggyFrames[4].Y = 0;
            doggyFrames[5].X = 5; doggyFrames[5].Y = 0;
            doggyFrames[6].X = 6; doggyFrames[6].Y = 0;
            doggyFrames[7].X = 7; doggyFrames[7].Y = 0;

            crazyDog.setWidthHeight(64, 64);
            crazyDog.setWidthHeightOfTex(1024, 128);
            crazyDog.setXframes(8);
            crazyDog.setYframes(0);
            crazyDog.setBB(0, 0, 128, 128);
            crazyDog.setAnimationSequence(playerFrames, 0, 7, 15);
            crazyDog.animationStart();
        }
Ejemplo n.º 7
0
        public override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(graphicsDevice);
            weaponList  = new SpriteList(20);

            playerXLocation = Dir.rnd.Next(0, 1000);
            playerYLocation = 880;
            enemyXLocation  = -20;
            enemyYLocation  = Dir.rnd.Next(213, 600);
            enemy2XLocation = Dir.rnd.Next(Dir.rightBoundary - 300, Dir.rightBoundary);
            anchorXLocation = Dir.rnd.Next(Dir.leftBoundary + 100, Dir.rightBoundary - 100);
            anchorYLocation = 175;

            texBackgroundLevel2    = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Sea04.png");
            texPlayer              = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\ship-md.png");
            texEnemy1              = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Merchant1.png");
            texEnemy2              = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Merchant2.png");
            texMissile             = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Torpedo5up.png");
            texMissileSmoke        = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Particle1.png");
            texExplostionAnimation = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\explodeWater1024x64.png");
            texMineExplostion      = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\explode1.png");
            texMouse        = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Mouse.png");
            texAnchor       = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\anchor-th.png");
            texLife         = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\life-preserver-th.png");
            texMine         = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\water_mine.png");
            scoreFont       = Content.Load <SpriteFont>("display");
            helpFont        = Content.Load <SpriteFont>("helpText");
            explostionSound = Content.Load <SoundEffect>("bazooka_fire");
            exLimSound      = new LimitSound(explostionSound, 3);

            backgroundLevel2        = new ImageBackground(texBackgroundLevel2, Color.White, graphicsDevice);
            player                  = new Sprite3(true, texPlayer, playerXLocation, playerYLocation);
            enemy1                  = new Sprite3(true, texEnemy1, enemyXLocation, enemyYLocation);
            enemy2                  = new Sprite3(true, texEnemy2, enemy2XLocation, enemyYLocation);
            explosionAnimation      = new Sprite3(true, texExplostionAnimation, 0, playerYLocation);
            mineExplostionAnimation = new Sprite3(true, texMineExplostion, 0, playerYLocation);
            mine = new Sprite3(true, texMine, 0, 0);
            mine.setHSoffset(new Vector2(296, 313));
            weaponList.addSpriteReuse(mine);
            life = new Sprite3(true, texLife, Dir.rnd.Next(Dir.leftBoundary + 200, Dir.rightBoundary - 200), Dir.rnd.Next(300, 600));
            life.setActiveAndVisible(false);

            for (int i = 1; i < 3; i++)
            {
                anchor = new Sprite3(true, texAnchor, anchorXLocation, anchorYLocation);
                anchor.setWidthHeight(50, 50);
                weaponList.addSpriteReuse(anchor);
            }
            for (int m = 1; m < 6; m++)
            {
                missile = new Sprite3(true, texMissile, playerXLocation, playerYLocation);
                missile.setWidthHeight(missile.getWidth() / 2, missile.getHeight() / 2);
                weaponList.addSpriteReuse(missile);
            }

            player.setColor(Color.Red);

            // Adjusting sprite image sizes to suit my taste
            player.setWidthHeight(210, 64);
            enemy1.setWidthHeight(256, 64);
            enemy2.setWidthHeight(enemy1.getWidth() / 2, 64);
            life.setWidthHeight(48, 48);
            mine.setWidthHeight(40, 45);

            // animation for torpedo explosion
            explosionAnimation.setWidthHeightOfTex(1024, 64);
            explosionAnimation.setXframes(16);
            explosionAnimation.setYframes(1);
            explosionAnimation.setWidthHeight(80, 80);
            for (int moveX = 0; moveX <= 15; moveX++)
            {
                anim[moveX].X = moveX; anim[moveX].Y = 0;
            }
            explosionAnimation.setAnimationSequence(anim, 0, 15, 3);
            explosionAnimation.setAnimFinished(0);
            explosionAnimation.animationStart();

            // animation for mine explostion
            mineExplostionAnimation.setWidthHeightOfTex(1024, 64);
            mineExplostionAnimation.setXframes(16);
            mineExplostionAnimation.setYframes(1);
            mineExplostionAnimation.setWidthHeight(80, 80);
            for (int moveX = 0; moveX <= 15; moveX++)
            {
                mineAnim[moveX].X = moveX; mineAnim[moveX].Y = 0;
            }
            mineExplostionAnimation.setAnimationSequence(mineAnim, 0, 15, 4);
            mineExplostionAnimation.setAnimFinished(0);
            mineExplostionAnimation.animationStart();

            HealthBarAttached h1 = new HealthBarAttached(Color.Aquamarine, Color.Green, Color.Red, 9, true);

            h1.offset                 = new Vector2(0, -1); // one pixel above the bounding box
            h1.gapOfbar               = 2;
            enemy1.hitPoints          = 10;
            enemy1.maxHitPoints       = 10;
            enemy1.attachedRenderable = h1;

            HealthBarAttached h2 = new HealthBarAttached(Color.Aquamarine, Color.Green, Color.Red, 9, true);

            h2.offset                 = new Vector2(0, -1); // one pixel above the bounding box
            h2.gapOfbar               = 2;
            enemy2.hitPoints          = 20;
            enemy2.maxHitPoints       = 20;
            enemy2.attachedRenderable = h2;

            HealthBarAttached playerHP = new HealthBarAttached(Color.Aquamarine, Color.Green, Color.Red, 9, true);

            playerHP.offset           = new Vector2(0, -1); // one pixel above the bounding box
            playerHP.gapOfbar         = 2;
            player.hitPoints          = 50;
            player.maxHitPoints       = 50;
            player.attachedRenderable = playerHP;

            drawSmoke();
        }