Exemple #1
0
 public World(Texture2D[] tileImages, Texture2D[] playerImages, Texture2D healthBack, Texture2D healthFront)
 {
     Width  = 25;
     Height = 15;
     Player = new Player(playerImages, new Vector2(450, 384));
     LoadTiles(tileImages);
     HealthBack      = healthBack;
     HealthFront     = healthFront;
     Boss            = new Boss(Game1.bossImages, new Vector2(350, 384), Player);
     CutsceneText    = new string[4][];
     CutsceneText[0] = new string[] { "Hey, friend. Its quite a nice night isn't it?", "Wait... What's that over there?" };
     CutsceneText[1] = new string[] { "*Punches you in the heart while you are distracted*" };
     CutsceneText[2] = new string[] { "Finally! A heart of my own!" };
     CutsceneText[3] = new string[] { "Dude, not cool!" };
     CutsceneNum     = 0;
     displayBox      = new TextDisplayBox(CutsceneText[CutsceneNum], new Vector2(160, 100), Game1.textCorner, Game1.textBar, Game1.textCenter, 30, 6, Game1.font16);
     continueMenu    = new Menu(new string[] { "Continue" }, new Vector2(240, 240), Game1.menuCorner, Game1.menuBar, Game1.menuCenter, 20, 5, Game1.font16);
     startX          = Player.Bounds.X + 32;
 }
Exemple #2
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            font144 = Content.Load <SpriteFont>("source-sans-144");
            font72  = Content.Load <SpriteFont>("source-sans-72");
            font16  = Content.Load <SpriteFont>("source-sans-16");
            font12  = Content.Load <SpriteFont>("source-sans-12");
            font10  = Content.Load <SpriteFont>("source-sans-10");

            titleBG    = Content.Load <Texture2D>("BackgroundGradRed");
            gameoverBG = Content.Load <Texture2D>("BackgroundBlack");
            victoryBG  = Content.Load <Texture2D>("BackgroundRed");

            menuCorner = Content.Load <Texture2D>("MenuCorner");
            menuBar    = Content.Load <Texture2D>("MenuSide");
            menuCenter = Content.Load <Texture2D>("Center");

            textCorner = Content.Load <Texture2D>("MenuCorner");
            textBar    = Content.Load <Texture2D>("MenuSide");
            textCenter = Content.Load <Texture2D>("Center");

            string[] t = { "Start Game", "Info Screen", "Exit" };
            titleMenu = new Menu(t, new Vector2(240, 240), menuCorner, menuBar, menuCenter, 20, 10, font16);

            string[] t2 = { "Heart Quest" };
            titleBox = new TextDisplayBox(t2, new Vector2(40, 50), textCorner, textBar, textCenter, 45, 10, font72);

            string[] t5 = { "Return to title", "Exit" };
            infoMenu = new Menu(t5, new Vector2(240, 240), menuCorner, menuBar, menuCenter, 20, 10, font16);

            string[] t6 = { "Made the weekend of April 30, 2016, at a 48 hr Neumont University Game Jam", "Created by Justin Furtado and Devin Duren", "Controls: w, a, d, to move, (s does nothing), e to punch, space bar to interact" };
            infoBox = new TextDisplayBox(t6, new Vector2(40, 50), textCorner, textBar, textCenter, 45, 10, font16);

            string[] t7 = { "Return to title", "Exit" };
            victoryMenu = new Menu(t7, new Vector2(240, 240), menuCorner, menuBar, menuCenter, 20, 10, font16);

            string[] t8 = { "Congratulations!" };
            victoryBox = new TextDisplayBox(t8, new Vector2(40, 10), textCorner, textBar, textCenter, 45, 10, font72);

            string[] t9 = { "Return to title", "Exit" };
            gameoverMenu = new Menu(t9, new Vector2(240, 240), menuCorner, menuBar, menuCenter, 20, 10, font16);

            string[] t10 = { "GAME OVER!" };
            gameoverBox = new TextDisplayBox(t10, new Vector2(40, 10), textCorner, textBar, textCenter, 45, 10, font72);

            string[] t11 = { "Art, programming and sound by Justin Furtado and Devin Duren" };
            credits = new TextDisplayBox(t11, new Vector2(40, 416), textCorner, textBar, textCenter, 45, 4, font16);

            string[] t12 = { "Thanks for playing, we hope you enjoyed Heart Quest" };
            thankYou = new TextDisplayBox(t12, new Vector2(40, 170), textCorner, textBar, textCenter, 45, 4, font16);

            playerImages    = new Texture2D[12];
            playerImages[0] = Content.Load <Texture2D>("PlayerSprite");
            playerImages[1] = Content.Load <Texture2D>("PlayerSpriteWalk");

            playerImages[2] = Content.Load <Texture2D>("PlayerSpriteLeft");
            playerImages[3] = Content.Load <Texture2D>("PlayerSpriteLeftWalk");

            playerImages[4] = Content.Load <Texture2D>("PlayerSpriteBlack");
            playerImages[5] = Content.Load <Texture2D>("PlayerSpriteWalkBlack");

            playerImages[6] = Content.Load <Texture2D>("PlayerSpriteLeftBlack");
            playerImages[7] = Content.Load <Texture2D>("PlayerSpriteLeftWalkBlack");

            playerImages[8] = Content.Load <Texture2D>("PlayerSpritePunch");
            playerImages[9] = Content.Load <Texture2D>("PlayerSpriteLeftPunch");

            playerImages[10] = Content.Load <Texture2D>("PlayerSpriteBlackPunch");
            playerImages[11] = Content.Load <Texture2D>("PlayerSpriteLeftBlackPunch");


            bossImages     = new Texture2D[12];
            bossImages[0]  = Content.Load <Texture2D>("BossSprite");
            bossImages[1]  = Content.Load <Texture2D>("BossSpriteWalk");
            bossImages[2]  = Content.Load <Texture2D>("BossSpriteLeft");
            bossImages[3]  = Content.Load <Texture2D>("BossSpriteLeftWalk");
            bossImages[4]  = Content.Load <Texture2D>("BossSpriteBlack");
            bossImages[5]  = Content.Load <Texture2D>("BossSpriteWalkBlack");
            bossImages[6]  = Content.Load <Texture2D>("BossSpriteLeftBlack");
            bossImages[7]  = Content.Load <Texture2D>("BossSpriteLeftWalkBlack");
            bossImages[8]  = Content.Load <Texture2D>("BossSpritePunch");
            bossImages[9]  = Content.Load <Texture2D>("BossSpriteLeftPunch");
            bossImages[10] = Content.Load <Texture2D>("BossSpriteBlackPunch");
            bossImages[11] = Content.Load <Texture2D>("BossSpriteLeftBlackPunch");


            healthBack  = Content.Load <Texture2D>("HealthBarBackground");
            healthFront = Content.Load <Texture2D>("HealthBarStatus");

            tileImages    = new Texture2D[3];
            tileImages[0] = Content.Load <Texture2D>("BaseTile");    // grass
            tileImages[1] = Content.Load <Texture2D>("TreeSection"); // trunks
            tileImages[2] = Content.Load <Texture2D>("TreeTops");    // leaves/branches

            flowerImages    = new Texture2D[3];
            flowerImages[0] = Content.Load <Texture2D>("Pot");
            flowerImages[1] = Content.Load <Texture2D>("Flower");
            flowerImages[2] = Content.Load <Texture2D>("CrushedPot");

            menuLoop = (Content.Load <SoundEffect>("title1")).CreateInstance();
            bossLoop = (Content.Load <SoundEffect>("bossv1")).CreateInstance();
            roamLoop = (Content.Load <SoundEffect>("roam1")).CreateInstance();

            menuLoop.IsLooped = true;
            menuLoop.Play();
            bossLoop.IsLooped = true;
            roamLoop.IsLooped = true;

            death         = Content.Load <SoundEffect>("death");
            menuSelection = Content.Load <SoundEffect>("menuselect");
            hurt          = Content.Load <SoundEffect>("hurt");
            potBreak      = Content.Load <SoundEffect>("potbreak1");
            jump          = Content.Load <SoundEffect>("jump");

            blackRect = Content.Load <Texture2D>("rect");

            screenBounds = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

            gameBG = Content.Load <Texture2D>("Forest");
        }
Exemple #3
0
        public void Update(GameTime gameTime)
        {
            if (Player.Cutscene)
            {
                if (Math.Abs(Player.Bounds.X - startX) >= distBetweenScenes)
                {
                    Player.Velocity = Vector2.Zero;

                    if (continueMenu != null)
                    {
                        continueMenu.ProcessInput();

                        if (continueMenu.IsOver)
                        {
                            CutsceneNum++;
                            if (CutsceneNum >= CutsceneText.Length)
                            {
                                continueMenu    = null;
                                displayBox      = null;
                                Player.Cutscene = false;
                                Game1.roamLoop.Stop();
                                Game1.bossLoop.Play();
                                return;
                            }

                            if (CutsceneNum == 2)
                            {
                                Player.Health -= 5;
                            }

                            displayBox = new TextDisplayBox(CutsceneText[CutsceneNum], new Vector2(160, 100), Game1.textCorner, Game1.textBar, Game1.textCenter, 30, 6, Game1.font16);
                            continueMenu.ResetMenu();
                            startX = Player.Bounds.X;
                        }
                    }
                }
                else
                {
                    Player.Velocity = new Vector2(-50.0f, 0);
                }
            }

            if (Player.Health > Boss.Health)
            {
                Player.HasHeart = true;
                Boss.HasHeart   = false;
            }
            else
            {
                Player.HasHeart = false;
                Boss.HasHeart   = true;
            }

            Player.Update(gameTime);

            // movement
            Vector2 potentialMove = Player.Velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;
            Vector2 actualMove    = CheckCollosionsFor(Player, potentialMove);

            Player.Stop(actualMove.X == 0, actualMove.Y == 0);
            Player.MoveBy(actualMove);

            if (Boss != null)
            {
                Boss.Update(gameTime);

                Vector2 bossMove       = Boss.Velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;
                Vector2 actualBossMove = CheckCollosionsFor(Boss, bossMove);
                Boss.Stop(actualBossMove.X == 0, actualBossMove.Y == 0);
                Boss.MoveBy(actualBossMove);

                // todo, if player hit different enemy
                if (Player.Punched)
                {
                    Player.Punched = false;

                    if (Boss.Bounds.Intersects(new Rectangle(Player.Bounds.X - 16, Player.Bounds.Y, Player.Bounds.Width + 32, Player.Bounds.Height)))
                    {
                        if (Player.CurrentImage == 11 || Player.CurrentImage == 9)
                        {
                            if (Boss.Bounds.X < Player.Bounds.X)
                            {
                                Boss.Health -= 1;
                            }
                        }
                        else if (Player.CurrentImage == 10 || Player.CurrentImage == 8)
                        {
                            if (Boss.Bounds.X > Player.Bounds.X)
                            {
                                Boss.Health -= 1;
                            }
                        }
                    }
                }
            }

            // interaction
            if (menu == null)
            {
                CheckInteractions();
            }
            else
            {
                menu.ProcessInput();
                if (menu.IsOver)
                {
                    Tiles[menuBelongsToX, menuBelongsToY].InteractedWith(Player, menu.Selection);
                    menu = null;
                }
            }
        }