//Constructor
        public InstructionScreen(Game1 game1)
        {
            game = game1; //assigns the game1 object to game attribute
            gameState = new GameState(game); // creates the gameState object and puts it into gamestate attribute
            font1 = game.Content.Load<SpriteFont>("Font1"); //loads the Font1 sprite font

            // LOAD ALL THE ART
            backwardsA = game.Content.Load<Texture2D>("backwards");
            backwardsArrow = game.Content.Load<Texture2D>("backwards arrow");
            forwardD = game.Content.Load<Texture2D>("forward ");
            forwardArrow = game.Content.Load<Texture2D>("forward arrow");
            grapple1 = game.Content.Load<Texture2D>("eGrapple");
            grapple2 = game.Content.Load<Texture2D>("leftshift");
            grapple3 = game.Content.Load<Texture2D>("rightShift");
            space = game.Content.Load<Texture2D>("space");
            pause = game.Content.Load <Texture2D>("pauseControl");
            color = game.Content.Load<Texture2D>("pause");
            back = game.Content.Load<Texture2D>("back");

            grappleDown1 = game.Content.Load<Texture2D>("grappleDownArrow");
            grappleDown2 = game.Content.Load<Texture2D>("grappleDownS");

            grappleUp1 = game.Content.Load<Texture2D>("grappleUPW");
            grappleUp2 = game.Content.Load<Texture2D>("grappleUPArrow");
            title = game.Content.Load<Texture2D>("instructionTitle");
        }
Beispiel #2
0
 //Constructor
 public EnemyPathEnd(int posX, int posY, int width, int height, bool top, Game1 game)
 {
     if (top == true)
     {
         enemyPathRect = new Rectangle(posX, posY, width, height);
     }
     else
     {
         enemyPathRect = new Rectangle(posX, posY + game.wallSprite.Height, width, height);
     }
 }
Beispiel #3
0
 //Constructor
 public CreditScreen(Game1 game1)
 {
     game = game1; //assigns the game1 object
     gameState = new GameState(game); //creates a new gamestate class object and assigns it to gamestate
     font1 = game.Content.Load<SpriteFont>("Font1"); // loads Font1 spriteFont
     back = game.Content.Load<Texture2D>("back");
     title = game.Content.Load<Texture2D>("creditsTitle");
     logo = game.Content.Load<Texture2D>("LavaLogo");
     names = game.Content.Load<Texture2D>("Names");
     bg = game.Content.Load<Texture2D>("pause");
     music = game.Content.Load<Texture2D>("musicCredits");
 }
Beispiel #4
0
 public Goal(Texture2D texture, int x, int y, int width, int height, Game1 game1, GameScreen gs)
 {
     game = game1;
     ls = new LevelScreen(game);
     theGame = game;
     save = new SaveInfo();
     state = new GameState(game);
     rect = new Rectangle(x, y, width, height);
     xPostion = x;
     yPostion = y;
     this.width = width;
     this.height = height;
     goalTexture = texture;
     gameScreen = gs;
 }
Beispiel #5
0
 //Constructor
 public OptionScreen(Game1 game1)
 {
     game = game1;
     gameState = new GameState(game); // creates new gamestate object and assigns it to gameState
     font1 = game.Content.Load<SpriteFont>("Font1"); //loads Font1
     back = game.Content.Load<Texture2D>("back");
     soundOn1 = game.Content.Load<Texture2D>("soundOn1");
     soundOn2 = game.Content.Load<Texture2D>("soundOn2");
     soundOff1 = game.Content.Load<Texture2D>("soundOff1");
     soundOff2 = game.Content.Load<Texture2D>("soundOff2");
     levelUnlock1 = game.Content.Load<Texture2D>("levelUnlock1");
     levelUnlock2 = game.Content.Load<Texture2D>("levelUnlock2");
     resetHS1 = game.Content.Load<Texture2D>("resetHS1");
     resetHS2 = game.Content.Load<Texture2D>("resetHS2");
     info = new SaveInfo();
     count = 0;
 }
        public EndLevelScreen(Game1 game1, string previousLevelIn, string currentLevelIn, string currentLevelName)
        {
            game = game1; //assigns the game1 object
            previousLevel = previousLevelIn;
            gameState = new GameState(game); //creates a new gamestate class object and assigns it to gamestate
            font1 = game.Content.Load<SpriteFont>("Font1"); // loads Font1 spriteFont
            count = 0;
            levelName = currentLevelName;
            currentLevel = currentLevelIn;

            // loading images
            continue1 = game.Content.Load<Texture2D>("continue1");
            continue2 = game.Content.Load<Texture2D>("continue2");

            tryAgain1 = game.Content.Load<Texture2D>("tryagain1");
            tryAgain2 = game.Content.Load<Texture2D>("tryagain2");

            quit1 = game.Content.Load<Texture2D>("quit1");
            quit2 = game.Content.Load<Texture2D>("quit2");
        }
Beispiel #7
0
        //Constructor
        public LevelScreen(Game1 game1)
        {
            save = new SaveInfo();
            game = game1;
            gameState = new GameState(game); // creates new gamestate object and assigns it to gameState
            font1 = game.Content.Load<SpriteFont>("Font1"); // loads Font1
            lastState = Keyboard.GetState();
            levels = save.ReadUnlock();

            back = game.Content.Load<Texture2D>("back");
            lvl1 = game.Content.Load<Texture2D>("level1");
            lvl2 = game.Content.Load<Texture2D>("level2");
            lvl3 = game.Content.Load<Texture2D>("level3");
            lvl4 = game.Content.Load<Texture2D>("level4");
            lvl5 = game.Content.Load<Texture2D>("level5");
            lvl6 = game.Content.Load<Texture2D>("level6");

            currentLvl = "level1.txt";
            nextLvl = "level2.txt";
        }
Beispiel #8
0
        //Constructor
        public PauseScreen(Game1 game1, GameScreen currentGame)
        {
            game = game1;// assigns game1 to game
            gameState = new GameState(game); // creates new gamestate object and assigns it to gameState
            font1 = game.Content.Load<SpriteFont>("Font1"); // loads Font1
            lastState = Keyboard.GetState();// sets keyboard state
            gameScreen = currentGame; // sets gameScreen to current Gamescreen
            screenWidth = 1000; //sets width to 1000
            screenHeight = 800; //sets height to 800

            button = 0;

            // load all the images
            title = game.Content.Load<Texture2D>("pauseTitle");
            continue1 = game.Content.Load<Texture2D>("continue1");
            continue2 = game.Content.Load<Texture2D>("continue2");
            options1 = game.Content.Load<Texture2D>("options1");
            options2 = game.Content.Load<Texture2D>("options2");
            howTo1 = game.Content.Load<Texture2D>("instruction1");
            howTo2 = game.Content.Load<Texture2D>("instruction2");
            screen = game.Content.Load<Texture2D>("pause");
        }
Beispiel #9
0
 // switched screen to Credit screen
 public void SwitchCredit(Game1 game)
 {
     creditScreen = new CreditScreen(game); //makes new credit screen
     currentScreen = Screen.CreditScreen; // sets current screen to credit screen
 }
Beispiel #10
0
 // switched screen to Option screen
 public void SwitchOption(Game1 game)
 {
     optionScreen = new OptionScreen(game); // makes new option screen
     currentScreen = Screen.OptionScreen; // sets current screen to option screen
 }
Beispiel #11
0
 //Constructors
 public GameState(Game1 game)
 {
     this.game = game;
     currentScreen = Screen.StartScreen; //current screen set to StartScreen State
 }
Beispiel #12
0
 // switched screen to instruction screen
 public void SwitchInstruct(Game1 game)
 {
     instructionScreen = new InstructionScreen(game); // makes new instruction screen
     currentScreen = Screen.InstructionScreen; // sets current screen to instruction screen
 }
Beispiel #13
0
 // switched screen to Level screen
 public void SwitchLevel(Game1 game)
 {
     levelScreen = new LevelScreen(game); //makes new level screen
     currentScreen = Screen.LevelScreen; // sets current screen to level screen
 }
Beispiel #14
0
        // constructor
        /// <summary>
        /// Sets up the default values.
        /// </summary>
        /// <param name="plrTx"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="wid"></param>
        /// <param name="hgt"></param>
        public Player(Texture2D plrTx, int x, int y, int wid, int hgt, List<Rectangle> colls, Game1 game1, GameScreen gS, Enemy enemy, Platform platform)
        {
            game = game1;
            oldState = Keyboard.GetState();
            playerTexture = plrTx;
            width = wid;
            height = hgt;
            playerRect = new Rectangle(x, y, width, height);
            xPostion = x;
            yPostion = y;
            position = new Vector2(x, y);
            velocity = new Vector2();
            hasJumped = false;
            currentState = State.Still;
            collisionsToCheck = colls;
            backwards = game.playerSprite_Backwards;
            gameScreen = gS;
            grappleEndpoint = new Vector2(playerRect.X, playerRect.Y);
            isGrappled = false;
            isStunned = false;
            timeSinceStun = 0;

            //Kasey added this // Alex added this... just the part of the comment mind you nothing else
            this.enemy = enemy;
            this.platform = platform;

            //images
            back1 = game.Content.Load<Texture2D>("playerBack2");
            back2 = game.Content.Load<Texture2D>("playerBack3");
            forward1 = game.Content.Load<Texture2D>("playerForward2");
            forward2 = game.Content.Load<Texture2D>("playerForward3");
            frame = 0;
            count = 0;

            if (MonitorSize.height > 1080)
            {
                JUMP_STRENGTH = 24;
                MAX_SPEED = 12;
                height += 32;
                width += 18;
            }
            else if (MonitorSize.height < 1080)
            {
                JUMP_STRENGTH = 18;
                MAX_SPEED = 9;
                height -= 32;
                width -= 18;
            }
        }
Beispiel #15
0
 //pauses game
 public void PauseGame(Game1 game1, GameScreen currentGame)
 {
     pauseScreen = new PauseScreen(game1, currentGame);
     currentScreen = Screen.PauseScreen;
 }
Beispiel #16
0
 public StartScreen(Game1 game1)
 {
     game = game1;
     gameState = new GameState(game); // creates new gamestate object and assigns gameState
     lastState = Keyboard.GetState();  // assigns keyboard state to lastState
 }
Beispiel #17
0
        //basic game screen constructor
        public GameScreen(Game1 game)
        {
            this.game = game;
            gameState = new GameState(game); //creates new gameState object and assigns it to game screen
            font1 = game.Content.Load<SpriteFont>("Font1"); //loads Font1

            drawList = new List<GameObject>();
            enemyList = new List<Enemy>();
            timeSinceLastMove = 0;
            enemyPathList = new List<EnemyPathEnd>();
            colList = new List<Rectangle>();
            gemsList = new List<Gold>();
            bulletList = new List<Bullet>();
            platformList = new List<Platform>();

            SaveInfo info = new SaveInfo();
            Dictionary<string, int> highscoreDict = info.ReadHighScore();
            highScore = highscoreDict[levelName];
            // reading in the file
            StreamReader input = null;

            input = new StreamReader(levelFile); // this will load in whatever level the player picks
            string text = "";
            level = input.ReadLine(); // brings in the level name
            text = input.ReadLine(); // brings in the high score as a string
            //int.TryParse(text, out highScore); // now its an int
            text = input.ReadLine(); // brings in the best time as a string
            double.TryParse(text, out bestTime); // now its a double

            text = input.ReadLine(); // read in width
            int.TryParse(text, out gameWidth);

            text = input.ReadLine(); // read in height
            int.TryParse(text, out gameHeight);

            int xPos = game.screenWidth / gameWidth;
            //int yPos = game.screenHeight / gameHeight;

            grappleableObjectList = new List<GameObject>();
            int y = -gameHeight + 8;
            while ((text = input.ReadLine()) != null)
            {

                int x = 0;
                string[] gamePiece = text.Split();
                foreach (string piece in gamePiece)
                {
                    if (piece == "w")
                    {
                        Platform block = new Platform(game.wallSprite, xPos * x + x, xPos * y + y, xPos, xPos);
                        drawList.Add(block);
                        colList.Add(block.rect);
                        platformList.Add(block);
                        grappleableObjectList.Add(block);
                    }
                    else if (piece == "c")
                    {
                        player = new Player(game.playerSprite, xPos * x + x, xPos * y + y, game.playerSprite.Width * 4, game.playerSprite.Height * 4, colList, game, this, enemy, block);
                    }
                    else if (piece == "f")
                    {
                        endGoal = new Goal(game.goalSprite, xPos * x + x, xPos * y + y, xPos, xPos, game, this);
                    }
                    else if (piece == "g")
                    {
                        gem = new Gold(game.gemSprite, xPos * x + 25, xPos * y + 35, game.gemSprite.Width, game.gemSprite.Height, this, game.coinS);
                        gemsList.Add(gem);
                    }
                    else if (piece == "e")
                    {
                        enemy = new Enemy(game.enemySprite, xPos * x, xPos * y + y, game.enemySprite.Width, game.enemySprite.Height, game, this, true, bulletList);
                        enemyList.Add(enemy);
                        bulletList.Add(enemy.MyBullet);
                    }
                    else if (piece == "t")
                    {
                        epe = new EnemyPathEnd(xPos * x + x, xPos * y + y, game.wallSprite.Width, 1, true, game);
                        enemyPathList.Add(epe);
                    }

                    // will add code later for all the other objects that are going to be shown

                    x++;
                }
                y++;
            }
            input.Close();
            input.Close();
            y--;
            lavaRect = new Rectangle(0, game.screenHeight - game.lavaBack.Height, game.screenWidth, game.lavaBack.Height);
        }
Beispiel #18
0
 static void Main()
 {
     using (var game = new Game1())
         game.Run();
 }