コード例 #1
0
        //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");
        }
コード例 #2
0
ファイル: CreditScreen.cs プロジェクト: Josh9309/TBD-The-Game
 //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");
 }
コード例 #3
0
ファイル: Goal.cs プロジェクト: Josh9309/TBD-The-Game
 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;
 }
コード例 #4
0
ファイル: OptionScreen.cs プロジェクト: Josh9309/TBD-The-Game
 //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;
 }
コード例 #5
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");
        }
コード例 #6
0
ファイル: LevelScreen.cs プロジェクト: Josh9309/TBD-The-Game
        //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";
        }
コード例 #7
0
ファイル: PauseScreen.cs プロジェクト: Josh9309/TBD-The-Game
        //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");
        }
コード例 #8
0
ファイル: Game1.cs プロジェクト: Josh9309/TBD-The-Game
        /// <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);

            // TODO: use this.Content to load your game content here
            gameState = new GameState(this);
            gameState.StartScreen = new StartScreen(this);

            playerSprite = Content.Load<Texture2D>("player_forward");
            playerSprite_Forward = Content.Load<Texture2D>("player_forward");
            playerSprite_Backwards = Content.Load<Texture2D>("player_backwards");
            wallSprite = Content.Load<Texture2D>("stone box");
            goalSprite = Content.Load<Texture2D>("goal");
            backgroundSprite = Content.Load<Texture2D>("background");
            titleSprite = Content.Load<Texture2D>("title");
            creditButton1 = Content.Load<Texture2D>("credit1");
            creditButton2 = Content.Load<Texture2D>("credit2");
            levelButton1 = Content.Load<Texture2D>("levelbutton1");
            levelButton2 = Content.Load<Texture2D>("levelbutton2");
            startButton1 = Content.Load<Texture2D>("startbutton1");
            startButton2 = Content.Load<Texture2D>("startbutton2");
            options1 = Content.Load<Texture2D>("options1");
            options2 = Content.Load<Texture2D>("options2");
            instructions1 = Content.Load<Texture2D>("instruction1");
            instructions2 = Content.Load<Texture2D>("instruction2");
            optionsTitle = Content.Load<Texture2D>("OptionsTitle");
            levelTitle = Content.Load<Texture2D>("levelSelectTitle");
            enemySprite = Content.Load<Texture2D>("enemy");
            bulletSprite = Content.Load<Texture2D>("bullet");
            gemSprite = Content.Load<Texture2D>("gem");
            lavaBack = Content.Load<Texture2D>("lavaBackground"); /////////////////////////////////////////
            lavaFront = Content.Load<Texture2D>("lavaForeground");
            jumpS = Content.Load<SoundEffect>("audio_jump.wav");
            grappleS = Content.Load<SoundEffect>("audio_grapple.wav");
            goalS = Content.Load<SoundEffect>("audio_goalReached");
            menuMoveS = Content.Load<SoundEffect>("audio_menuMove.wav");
            showdownS = Content.Load<SoundEffect>("audio_showdown");
            defaultMusS = Content.Load<SoundEffect>("backgroundMusic");
            coinS = Content.Load<SoundEffect>("audio_coin");

            Random rand = new Random();
            double volume;
            if (rand.Next(2) == 0)
            {
                Music.backgroundMusic = defaultMusS;
                volume = .1;
            }
            else
            {
                Music.backgroundMusic = showdownS;
                volume = .5;
            }

            try
            {
                backgroundMusic = Music.backgroundMusic.CreateInstance();
            }
            catch
            {
                Music.canPlay = false;
                playMusic = false;
            }

            if(Music.canPlay)
            {
                backgroundMusic.Volume = (float)volume;

                backgroundMusic.IsLooped = true;

                if (playMusic)
                {
                    backgroundMusic.Play();
                }
            }

            // Anna Stuff
            picHeight = 0;
            picWidth = 0;
        }
コード例 #9
0
ファイル: GameScreen.cs プロジェクト: Josh9309/TBD-The-Game
        //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);
        }
コード例 #10
0
ファイル: StartScreen.cs プロジェクト: Josh9309/TBD-The-Game
 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
 }