Example #1
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //Define all variables not defined in Initizalize
            doors     = new bool[] { true, false, true, true, false, false };
            gamestate = GameState.Menu;
            menuTex   = Content.Load <Texture2D>("MenuScreen1");
            createMap();
            startGame = new Button(530, 480, 405, 150);
            playerTex = Content.Load <Texture2D>("Player");
            player    = new PlayerTest(nodes[0], new Rectangle((graphics.GraphicsDevice.Viewport.Width / 2) - (playerTex.Width / 2), 100, 50, 50), play);
            play      = new Player(player, 3, 0);
            twelve    = Content.Load <Texture2D>("0");
            two       = Content.Load <Texture2D>("1");
            four      = Content.Load <Texture2D>("2");
            six       = Content.Load <Texture2D>("3");
            eight     = Content.Load <Texture2D>("4");
            ten       = Content.Load <Texture2D>("5");
            lineTest  = Content.Load <Texture2D>("LineTest");
            //Load Content
            caveTex             = Content.Load <Texture2D>("Cave");
            edge                = Content.Load <Texture2D>("ViewportEdge");
            inventoryBackground = Content.Load <Texture2D>("InventoryBackground");
            trivia              = new Trivia();
            tQuestion           = new TriviaQuestion("", 0);
            tAnswerA            = new TriviaAnswer("", 1);
            tAnswerB            = new TriviaAnswer("", 2);
            tAnswerC            = new TriviaAnswer("", 3);
            tAnswerD            = new TriviaAnswer("", 4);
            spriteFont          = Content.Load <SpriteFont>("SpriteFont1");
            UIFont              = Content.Load <SpriteFont>("UIFont");
            oldState            = Keyboard.GetState();
            dummyTexture        = new Texture2D(GraphicsDevice, 1, 1); //Creates a dummy texture to make solid black rectangles
            dummyTexture.SetData(new Color[] { Color.Black });
            caveCover         = Content.Load <Texture2D>("Cover");
            gamestate         = GameState.Menu; //Starts game on menu
            newPos            = new Vector2(player.bounding.Center.X, player.bounding.Center.Y);
            player.targetRoom = nodes[4];
            highScore         = new HighScore(0, 0, 0);
            soup = Content.Load <Texture2D>("soup");
            player.items.Add(new Item("Bowl of Soup", "Warm and thick, just like mom used to make...", soup, new Rectangle(700, 600, 100, 150), 0));
            double hypotinuse = Math.Sqrt(Math.Pow((player.bounding.Center.X - newPos.X), 2) + Math.Pow((player.bounding.Center.Y - newPos.Y + 16), 2));

            newPos = new Vector2(player.targetRoom.pos.X + 100, player.targetRoom.pos.Y + 100);
            speed  = new Vector2(Convert.ToSingle((player.bounding.Center.X - newPos.X) / hypotinuse), Convert.ToSingle((player.bounding.Center.Y - newPos.Y) / hypotinuse));
        }
Example #2
0
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     //Define all variables not defined in Initizalize
     doors = new bool[] { true, false, true, true, false, false };
     gamestate = GameState.Menu;
     menuTex = Content.Load<Texture2D>("MenuScreen1");
     createMap();
     startGame = new Button(530, 480, 405, 150);
     playerTex = Content.Load<Texture2D>("Player");
     player = new PlayerTest(nodes[0], new Rectangle((graphics.GraphicsDevice.Viewport.Width / 2) - (playerTex.Width / 2), 100, 50, 50), play);
     play = new Player(player, 3, 0);
     twelve = Content.Load<Texture2D>("0");
     two = Content.Load<Texture2D>("1");
     four = Content.Load<Texture2D>("2");
     six = Content.Load<Texture2D>("3");
     eight = Content.Load<Texture2D>("4");
     ten = Content.Load<Texture2D>("5");
     lineTest = Content.Load<Texture2D>("LineTest");
     //Load Content
     caveTex = Content.Load<Texture2D>("Cave");
     edge = Content.Load<Texture2D>("ViewportEdge");
     inventoryBackground = Content.Load<Texture2D>("InventoryBackground");
     trivia = new Trivia();
     tQuestion = new TriviaQuestion("", 0);
     tAnswerA = new TriviaAnswer("", 1);
     tAnswerB = new TriviaAnswer("", 2);
     tAnswerC = new TriviaAnswer("", 3);
     tAnswerD = new TriviaAnswer("", 4);
     spriteFont = Content.Load<SpriteFont>("SpriteFont1");
     UIFont = Content.Load<SpriteFont>("UIFont");
     oldState = Keyboard.GetState();
     dummyTexture = new Texture2D(GraphicsDevice, 1, 1); //Creates a dummy texture to make solid black rectangles
     dummyTexture.SetData(new Color[] { Color.Black });
     caveCover = Content.Load<Texture2D>("Cover");
     gamestate = GameState.Menu; //Starts game on menu
     newPos = new Vector2(player.bounding.Center.X, player.bounding.Center.Y );
     player.targetRoom = nodes[4];
     highScore = new HighScore(0, 0, 0);
     soup = Content.Load<Texture2D>("soup");
     player.items.Add(new Item("Bowl of Soup", "Warm and thick, just like mom used to make...", soup, new Rectangle(700, 600, 100, 150), 0));
     double hypotinuse = Math.Sqrt(Math.Pow((player.bounding.Center.X - newPos.X), 2) + Math.Pow((player.bounding.Center.Y - newPos.Y + 16), 2));
     newPos = new Vector2(player.targetRoom.pos.X + 100, player.targetRoom.pos.Y + 100);
     speed = new Vector2(Convert.ToSingle((player.bounding.Center.X - newPos.X) / hypotinuse), Convert.ToSingle((player.bounding.Center.Y - newPos.Y) / hypotinuse));
 }