Ejemplo n.º 1
0
        public LevelInfo(XElement levelInfo, ContentManager content, IControlScheme controls, GraphicsDeviceManager graphics)
        {
            foreach (XElement element in levelInfo.Elements())
            {
                if (element.Name == XmlKeys.LEVEL_NAME)
                    mLevel = new Level(WorldSelect.LEVEL_DIRECTORY + element.Value.ToString() + ".xml",
                        controls, graphics.GraphicsDevice.Viewport);
                if (element.Name == XmlKeys.TIMERSTAR)
                    mTimeStars = mLevel.TimerStar = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.COLLECTIONSTAR)
                    mCollectableStars = mLevel.CollectionStar = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.DEATHSTAR)
                    mDeathStars = mLevel.DeathStar = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.GOALTIME)
                    mGoalTime = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.GOALCOLLECTABLE)
                    mGoalCollectable = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.UNLOCKED)
                    mUnlocked = element.Value == XmlKeys.TRUE;
            }
            mContent = content;
            mGraphics = graphics;
            mControls = controls;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            mGraphics.PreferredBackBufferWidth = mGraphics.GraphicsDevice.DisplayMode.Width;
            mGraphics.PreferredBackBufferHeight = mGraphics.GraphicsDevice.DisplayMode.Height;
            mGraphics.ToggleFullScreen();
            mGraphics.ApplyChanges();

            mObjects = new List<PhysicsObject>();
            mCurrentLevel = new Level();
            mPhysicsEnvironment = new PhysicsEnvironment();

            base.Initialize();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor for the credits screen. Sets up the list of names and categories to scrolll up
        /// </summary>
        /// <param name="controlScheme">Player's method of control</param>
        /// <param name="graphics">Graphics Manager for the game</param>
        public Credits(IControlScheme controlScheme, GraphicsDeviceManager graphics)
        {
            mControls = controlScheme;
            mGraphics = graphics;
            mTopY = mGraphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom;

            mBackgroundLevel = Level.MainMenuLevel("Content\\Levels\\MainMenu.xml", mControls, mGraphics.GraphicsDevice.Viewport, mGraphics.GraphicsDevice.Viewport.Bounds);
            mBackgroundLevel.StartingPoint = new Vector2(mGraphics.GraphicsDevice.Viewport.Bounds.Center.X + mGraphics.GraphicsDevice.Viewport.Bounds.Center.X * .2f,
                                                        mGraphics.GraphicsDevice.Viewport.Bounds.Center.Y + mGraphics.GraphicsDevice.Viewport.Bounds.Center.Y * .1f);

            //Easily add names and titles here
            mTitles = new Dictionary<string, string[]>();
            mTitles.Add("Angry Newton Production", new string[] { "", "Angry" });
            mTitles.Add("Developed At", new string[] { "University Of Utah; Senior EAE Capstone Class" });
            mTitles.Add("Executive Producer", new string[]{"Roger Altizer", "Dr. Bob Kessler"});
            mTitles.Add("Original Concept & Design", new string[] { "Tyler Robinson" });
            mTitles.Add("Team Lead", new string[] { "Curtis Taylor" });
            mTitles.Add("-Programming-", new string[]{ "", "Surprise"});
            mTitles.Add("Lead Programmer", new string[] { "Tyler Robinson" });
            mTitles.Add("Programmers", new string[] { "Curtis Taylor", "Nate Bradford", "Jeremy Heintz", "Casey Spencer", "Kamron Egan", "Morgan Reynolds" });
            mTitles.Add("Xbox Tech", new string[] { "Kamron Egan" });
            mTitles.Add("-Art-", new string[] { "", "Laugh" });
            mTitles.Add("Lead Artist", new string[] { "Lukas Black" });
            mTitles.Add("Artists", new string[] { "Nate Bradford", "Jeremy Heintz", "Casey Spencer" });
            mTitles.Add("Animations", new string[] { "Lukas Black", "Nate Bradford", "Jeremy Heintz", "Kamron Egan" });
            mTitles.Add("-Design & Development-", new string[] { "", "Bored" } );
            mTitles.Add("Character Design", new string[] { "Lukas Black" });
            mTitles.Add("Level Design", new string[]{"Nate Bradford", "Curtis Taylor", "Jeremy Heintz", "Morgan Reynolds", "Steven Doxey", "Casey Spencer"});
            mTitles.Add("Game Mechanics", new string[] { "Tyler Robinson", "Curtis Taylor", "Morgan Reynolds" });
            mTitles.Add("-Music & Sound-", new string[] { "", "Worry" });
            mTitles.Add("Music Lead", new string[] { "Steven Doxey" });
            mTitles.Add("Music", new string[] { "Michelle MacArt", "Cuyler Stuwe" });
            mTitles.Add("Sound FX Lead", new string[] { "Steven Doxey" });
            mTitles.Add("Sound FX", new string[] { "Michelle MacArt", "Tyler Robinson", "Morgan Reynolds" });
            mTitles.Add("Find Us", new string[] { "", "Laugh2" });
            mTitles.Add("Our Official Website", new string[] { "TBD" });
            mTitles.Add("EAE Website", new string[] { "http://eae.utah.edu" });
            mTitles.Add("Like us on Facebook", new string[] { "http://www.facebook.com/", "Search Mr. Gravity" });
            mTitles.Add("Follow us on Twitter", new string[] { "http://www.twitter.com/AngryNewton", "Or @AngryNewton"});
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles when the A key is pressed
        /// </summary>
        private void HandleAKey(ref GameStates gameState, ref Level currentLevel)
        {
            if (mControls.isAPressed(false) || mControls.isStartPressed(false))
            {
                if (GameSound.volume != 0)
                    GameSound.menuSound_select.Play();

                if (mLevels[mCurrentWorld * 6 + mCurrentIndex].Unlocked)
                    mLoading = START_LOAD;

                //Handle level select
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // current viewport
            float screenscaleX =
                (float)mGraphics.GraphicsDevice.Viewport.Width / 1280.0f;
            float screenscaleY = (float)mGraphics.GraphicsDevice.Viewport.Height / 720.0f;
            // Create the scale transform for Draw.
            // Do not scale the sprite depth (Z=1).
            scale = Matrix.CreateScale(screenscaleX, screenscaleY, 1);

            //mGraphics.PreferredBackBufferWidth = 1280;
            //mGraphics.PreferredBackBufferHeight = 720;
            //mGraphics.ApplyChanges();

            mTitle.Load(Content, mGraphics.GraphicsDevice);

            mMainMenu.Load(Content);
            mMainMenuLevel = Level.MainMenuLevel("Content\\Levels\\MainMenu.xml", mControls, mGraphics.GraphicsDevice.Viewport, mMainMenu.GetInnerRegion());

            mMainMenuLevel.Load(Content);
            mCredits.Load(Content);
            mOptions.Load(Content);

            //mMenu.Load(Content, mGraphics.GraphicsDevice);
            mScoring.Load(Content, mGraphics.GraphicsDevice);
            mPause.Load(Content);
            GameSound.Load(Content);
            mCurrentLevel = new Level(mLevelLocation, mControls, GraphicsDevice.Viewport);
            mCurrentLevel.Load(Content);

            mWorldSelect.Load(Content);
            mAfterScore.Load(Content, GraphicsDevice);
            mResetConfirm.Load(Content);
            mController.Load(Content);
            mSoundOptions.Load(Content);
            mStartLevelSplash.Load(Content, GraphicsDevice);
            // Create a new SpriteBatch, which can be used to draw textures.
            mSpriteBatch = new SpriteBatch(GraphicsDevice);

            mDefaultFont = Content.Load<SpriteFont>("Fonts/Kootenay");
            mQuartz = Content.Load<SpriteFont>("Fonts/QuartzLarge");
            mHUDTrans = Content.Load<Texture2D>("Images/HUD/HUDTrans");

            mLives = new Texture2D[6];
            mLives[5] = Content.Load<Texture2D>("Images/Player/Laugh2");
            mLives[4] = Content.Load<Texture2D>("Images/Player/Laugh");
            mLives[3] = Content.Load<Texture2D>("Images/Player/Smile");
            mLives[2] = Content.Load<Texture2D>("Images/Player/Surprise");
            mLives[1] = Content.Load<Texture2D>("Images/Player/Worry");
            mLives[0] = Content.Load<Texture2D>("Images/Player/Dead2");
        }
Ejemplo n.º 6
0
        /*
         * Draw
         *
         * This function will draw the current menu
         *
         * SpriteBatch spriteBatch: The current sprite batch used to draw
         *
         * GraphicsDeviceManager graphics: The current graphics manager
         */
        public void Draw(SpriteBatch spriteBatch, GraphicsDeviceManager graphics, Matrix scale, Level currentLevel)
        {
            spriteBatch.Begin(SpriteSortMode.Immediate,
                BlendState.AlphaBlend,
                SamplerState.LinearClamp,
                DepthStencilState.None,
                RasterizerState.CullCounterClockwise,
                null,
                scale);

            float[] mSize = new float[2] { (float)mScreenRect.Width / (float)graphics.GraphicsDevice.Viewport.Width, (float)mScreenRect.Height / (float)graphics.GraphicsDevice.Viewport.Height };
            spriteBatch.Draw(mTrans, new Rectangle(mScreenRect.Left, mScreenRect.Top, mScreenRect.Width, mScreenRect.Height), Color.White);

            if (!mDoOnce)
            {
                if (currentLevel.CollectionStar == 3 && (mWorldSelect.getLevelCollect()) != 3)
                {
                    starList.Add(gemString);
                }
                if (currentLevel.TimerStar == 3 && (mWorldSelect.getLevelTime()) != 3)
                {
                    starList.Add(timeString);
                }
                if (currentLevel.DeathStar == 3 && (mWorldSelect.getLevelDeath()) != 3)
                {
                    starList.Add(deathString);
                }
                mDoOnce = true;
            }

            if (starList.Count == 1)
            {
                if (current >= xCoord)
                {
                    current-= 100;
                }
                spriteBatch.DrawString(mQuartz, starList[0], new Vector2(current, centerYCoord), Color.White, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
                spriteBatch.DrawString(mQuartz, starList[0], new Vector2(current + 4, centerYCoord + 4), Color.SteelBlue, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
            }
            else if (starList.Count == 2)
            {
                if (current >= xCoord)
                {
                    current -= 100;
                }

                spriteBatch.DrawString(mQuartz, starList[0], new Vector2(current, topYCoord2), Color.White, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
                spriteBatch.DrawString(mQuartz, starList[0], new Vector2(current + 4, topYCoord2 + 4), Color.SteelBlue, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);

                spriteBatch.DrawString(mQuartz, starList[1], new Vector2(current, bottomYCoord2), Color.White, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
                spriteBatch.DrawString(mQuartz, starList[1], new Vector2(current + 4, bottomYCoord2 + 4), Color.SteelBlue, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
            }
            else if (starList.Count == 3)
            {
                if (current >= xCoord)
                {
                    current -= 100;
                }

                spriteBatch.DrawString(mQuartz, starList[0], new Vector2(current, topYCoord3), Color.White, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
                spriteBatch.DrawString(mQuartz, starList[0], new Vector2(current + 4, topYCoord3 + 4), Color.SteelBlue, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);

                spriteBatch.DrawString(mQuartz, starList[1], new Vector2(current, centerYCoord), Color.White, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
                spriteBatch.DrawString(mQuartz, starList[1], new Vector2(current + 4, centerYCoord + 4), Color.SteelBlue, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);

                spriteBatch.DrawString(mQuartz, starList[2], new Vector2(current, bottomYCoord3), Color.White, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
                spriteBatch.DrawString(mQuartz, starList[2], new Vector2(current + 4, bottomYCoord3 + 4), Color.SteelBlue, 0.0f, Vector2.Zero, mScale, SpriteEffects.None, 0.0f);
            }

            spriteBatch.End();
        }
Ejemplo n.º 7
0
        /*
         * Update
         *
         * Updates the menu depending on what the user has selected.
         * It will handle the title, options, load and all other menu
         * screens
         *
         * GameTime gameTime: The current game time variable
         */
        public void Update(GameTime gameTime, ref GameStates gameState, ref Level level)
        {
            elapsedTime += gameTime.ElapsedGameTime.TotalSeconds;

            if (mScale < 1 && !upToScale)
            {
                mScale += 0.05f;
            }
            else if (mScale >= 1.0f && mScale <= 1.02f && !pulse)
            {
                upToScale = false;
                mScale += 0.001f;
                if (mScale > 1.02f)
                    pulse = true;
            }
            else if (pulse)
            {
                mScale -= 0.001f;
                if (mScale <= 1.002f)
                    pulse = false;
            }
            /* If the user selects one of the menu items */
            if (mControls.isAPressed(false) || mControls.isStartPressed(false) || elapsedTime >= 3.0)
            {
                GameSound.menuSound_select.Play(GameSound.volume, 0.0f, 0.0f);

                /*Back To Level Selection*/
                gameState = GameStates.Score;

                reset();
            }
        }
Ejemplo n.º 8
0
        /*
         * Update
         *
         * Updates the menu depending on what the user has selected.
         * It will handle the title, options, load and all other menu
         * screens
         *
         * GameTime gameTime: The current game time variable
         */
        public void Update(GameTime gameTime, ref GameStates gameState, ref Level level)
        {
            /* If the user hits up */
            if (mControls.isUpPressed(false))
            {
                /* If we are not on the first element already */
                if (mCurrent > 0)
                {
                    GameSound.menuSound_rollover.Play(GameSound.volume, 0.0f, 0.0f);
                    /* Decrement current and change the images */
                    mCurrent--;
                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
            }
            /* If the user hits the down button */
            if (mControls.isDownPressed(false))
            {
                /* If we are on the last element in the menu */
                if (mCurrent < NUM_OPTIONS - 1)
                {
                    GameSound.menuSound_rollover.Play(GameSound.volume, 0.0f, 0.0f);
                    /* Increment current and update graphics */
                    mCurrent++;
                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
            }

            /* If the user selects one of the menu items */
            if (mControls.isAPressed(false) || mControls.isStartPressed(false))
            {
                level.mTimer = 0;
                GameSound.menuSound_select.Play(GameSound.volume, 0.0f, 0.0f);

                /* Level Select */
                if (mCurrent == 0)
                {
                    /*Back To Level Selection*/
                    gameState = GameStates.Level_Selection;

                    mCurrent = 0;

                    mItems[0] = mSelectLevelSel;
                    mItems[1] = mRestartUnsel;
                    mItems[2] = mMainMenuUnsel;
                }

                /* Restart Level */
                else if (mCurrent == 1)
                {

                    /* Start the game*/
                    gameState = GameStates.StartLevelSplash;
                    level.ResetAll();
                    mCurrent = 0;

                    mItems[0] = mSelectLevelSel;
                    mItems[1] = mRestartUnsel;
                    mItems[2] = mMainMenuUnsel;
                }

                /* Main Menu */
                else if (mCurrent == 2)
                {
                    gameState = GameStates.Main_Menu;

                    mCurrent = 0;

                    mItems[0] = mSelectLevelSel;
                    mItems[1] = mRestartUnsel;
                    mItems[2] = mMainMenuUnsel;
                }
            }
        }
Ejemplo n.º 9
0
 /*
  * Update
  *
  * Updates the menu depending on what the user has selected.
  * It will handle the title, options, load and all other menu
  * screens
  *
  * GameTime gameTime: The current game time variable
  */
 public void Update(GameTime gameTime, ref GameStates gameState, ref Level level, WorldSelect worldSelect)
 {
     if (mControls.isStartPressed(false) || mControls.isAPressed(false))
     {
         gameState = GameStates.AfterScore;
     //#if XBOX360
     //                mSelect.Save(((ControllerControl)mControls).ControllerIndex);
     //#else
     //                mSelect.Save(PlayerIndex.One);
     //#endif
     }
 }
Ejemplo n.º 10
0
        /* GetRank
         *
         * int time: time to complete level
         *
         * int timeGoal: goal time
         *
         * int collect: collectables received
         *
         * int collectGoal: Total collectables in level
         *
         * int deathTotal: number of deaths
         *
         * return int[] (number of stars-- 0=Bad, 1=Okay, 2=Good, 3=Perfect): [Time, Collectables, Death]

        public int[] GetRank(int time, int timeGoal, int collect, int collectGoal, int deathTotal)
        {
            int[] result = new int[3];

            // TIME -- 100%+, <120%, <140%, >140%
            if (time < timeGoal)
            { result[0] = 3; }
            else if (((double) time / (double) timeGoal) < 1.2) { result[0] = 2; }
            else { result[0] = 1; }

            // COLLECTABLES -- 100%, >80%, >60%, <60%
            if (collect == collectGoal) { result[1] = 3; }
            else if (((double) collect / (double) collectGoal) > 0.8) { result[1] = 2; }
            else { result[1] = 1; }

            // DEATHS -- 0, 1, 2-3, >3 //
            if (deathTotal == 0) { result[2] = 3; }
            else if (deathTotal >= 2) { result[2] = 2; }
            else { result[2] = 1; }

            return result;
        }*/
        /*
         * Draw
         *
         * This function will draw the current menu
         *
         * SpriteBatch spriteBatch: The current sprite batch used to draw
         *
         * GraphicsDeviceManager graphics: The current graphics manager
         */
        public void Draw(SpriteBatch spriteBatch, GraphicsDeviceManager graphics, Level level, Matrix scale)
        {
            spriteBatch.Begin(SpriteSortMode.Immediate,
                BlendState.AlphaBlend,
                SamplerState.LinearClamp,
                DepthStencilState.None,
                RasterizerState.CullCounterClockwise,
                null,
                scale);

            // TODO - CHANGE TO DYNAMIC PLACEMENT

            float textLength = mQuartz.MeasureString("Deaths:").Length();
            float bufferLength = mQuartz.MeasureString("999/999  ").Length();

            int topPadding = mScreenRect.Top + mScreenRect.Height / 4;
            int[] attempt = {level.TimerStar, level.CollectionStar, level.DeathStar};
            int[] previous = { mWorldSelect.getLevelTime(), mWorldSelect.getLevelCollect(), mWorldSelect.getLevelDeath() };
            //attempt = GetRank((int)level.mTimer, (int)level.IdealTime, (int)GravityShift.Level.mNumCollected, (int)GravityShift.Level.mNumCollectable, (int)GravityShift.Level.mDeaths);
            spriteBatch.Draw(mBackground, new Rectangle(0, 0, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height), Color.White);
            spriteBatch.Draw(mTitle, new Vector2(mScreenRect.Left + (mScreenRect.Width - mTitle.Width) / 2, mScreenRect.Top), Color.White);

            spriteBatch.DrawString(mQuartz, "Time:", new Vector2(mScreenRect.Left + (mScreenRect.Width / 6), topPadding), Color.White);
            spriteBatch.DrawString(mQuartz, "Time:", new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + 1, topPadding + 1), Color.SteelBlue);
            spriteBatch.DrawString(mQuartz, (int)level.mTimer + " Sec", new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + 20, topPadding), Color.White);

            //Draw Stars
            if (attempt[0] >= 1)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength, topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);
            if (attempt[0] >= 2)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength + (0.5f * (mStar.Width)), topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);
            if (attempt[0] == 3)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength + (0.5f * (2 * mStar.Width)), topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);

            level.TimerStar = attempt[0];

            if (previous[0] > attempt[0])
            {
                spriteBatch.DrawString(mQuartz, "Your Best: " + previous[0] + "/3", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Your Best: " + previous[0] + "/3", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);

            }
            else if(attempt[0] < 3)
            {
                spriteBatch.DrawString(mQuartz, "Best So Far!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Best So Far!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);
            }

            else
            {
                spriteBatch.DrawString(mQuartz, "Perfect!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Perfect!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);
            }

            topPadding += 65;

            spriteBatch.DrawString(mQuartz, "Gems:", new Vector2(mScreenRect.Left + (mScreenRect.Width / 6), topPadding), Color.White);
            spriteBatch.DrawString(mQuartz, "Gems:", new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + 1, topPadding + 1), Color.SteelBlue);
            spriteBatch.DrawString(mQuartz, (int)GravityShift.Level.mNumCollected + " / " + GravityShift.Level.mNumCollectable, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + 20, topPadding), Color.White);

            if (attempt[1] >= 1)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength, topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);
            if (attempt[1] >= 2)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength + (0.5f * (mStar.Width)), topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);
            if (attempt[1] == 3)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength + (0.5f * (2 * mStar.Width)), topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);

            level.CollectionStar = attempt[1];
            if (previous[1] > attempt[1])
            {
                spriteBatch.DrawString(mQuartz, "Your Best: " + previous[0] + "/3", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Your Best: " + previous[0] + "/3", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);

            }
            else if (attempt[1] < 3)
            {
                spriteBatch.DrawString(mQuartz, "Best So Far!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Best So Far!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);
            }

            else
            {
                spriteBatch.DrawString(mQuartz, "Perfect!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Perfect!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);
            }

            topPadding += 65;

            spriteBatch.DrawString(mQuartz, "Deaths:", new Vector2(mScreenRect.Left + (mScreenRect.Width / 6), topPadding), Color.White);
            spriteBatch.DrawString(mQuartz, "Deaths:", new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + 1, topPadding + 1), Color.SteelBlue);
            spriteBatch.DrawString(mQuartz, "" + (int)GravityShift.Level.mDeaths, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + 20, topPadding), Color.White);

            //Draw Stars
            if (attempt[2] >= 1)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength, topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);
            if (attempt[2] >= 2)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength + (0.5f * (mStar.Width)), topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);
            if (attempt[2] == 3)
                spriteBatch.Draw(mStar, new Vector2(mScreenRect.Left + (mScreenRect.Width / 6) + textLength + bufferLength + (0.5f * (2 * mStar.Width)), topPadding), null, Color.White, 0.0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0.0f);

            level.DeathStar = attempt[2];

            if (previous[2] > attempt[2])
            {
                spriteBatch.DrawString(mQuartz, "Your Best: " + previous[0] + "/3", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Your Best: " + previous[0] + "/3", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);

            }
            else if (attempt[2] < 3)
            {
                spriteBatch.DrawString(mQuartz, "Best So Far!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Best So Far!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);
            }

            else
            {
                spriteBatch.DrawString(mQuartz, "Perfect!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16), topPadding), Color.White);
                spriteBatch.DrawString(mQuartz, "Perfect!", new Vector2(mScreenRect.Left + (11 * mScreenRect.Width / 16) + 1, topPadding + 1), Color.SteelBlue);
            }

            string request = "Press Start or A To Access The Menu";

            Vector2 stringSize = mQuartz.MeasureString(request);

            spriteBatch.DrawString(mQuartz, request, new Vector2(mScreenRect.Center.X - (stringSize.X / 2), mScreenRect.Bottom - (stringSize.Y) * 2), Color.SteelBlue);
            spriteBatch.DrawString(mQuartz, request, new Vector2(mScreenRect.Center.X - (stringSize.X / 2) + 2, mScreenRect.Bottom - (stringSize.Y) * 2 + 2), Color.White);

            spriteBatch.End();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Handles when the A key is pressed
        /// </summary>
        private void HandleAKey(ref GameStates gameState, ref Level currentLevel)
        {
            if (mControls.isAPressed(false) || mControls.isStartPressed(false))
            {
                if (mShowCongrats)
                { mShowCongrats = false; return; }

                if (GameSound.volume != 0)
                    GameSound.menuSound_select.Play();

                if (mLevels[mCurrentWorld * 6 + mCurrentIndex].Unlocked)
                    mLoading = START_LOAD;
            #if XBOX360
                else if (TrialMode)
                {
                    if (!Guide.IsVisible)
                    {
                        SignedInGamer gamer = Gamer.SignedInGamers[((ControllerControl)mControls).ControllerIndex];

                        if (gamer != null && !gamer.IsGuest && gamer.IsSignedInToLive)
                        {
                            if (gamer.Privileges.AllowPurchaseContent)
                            {
                                Guide.ShowMarketplace(((ControllerControl)mControls).ControllerIndex);
                            }
                        }
                    }
                }
            #endif

                //Handle level select
            }
        }
Ejemplo n.º 12
0
        /*
         * Draw
         *
         * This function will draw the current menu
         *
         * SpriteBatch spriteBatch: The current sprite batch used to draw
         *
         * GraphicsDeviceManager graphics: The current graphics manager
         */
        public void Draw(SpriteBatch spriteBatch, GraphicsDeviceManager graphics, Level level, Matrix scale)
        {
            spriteBatch.Begin(SpriteSortMode.Immediate,
                BlendState.AlphaBlend,
                SamplerState.LinearClamp,
                DepthStencilState.None,
                RasterizerState.CullCounterClockwise,
                null,
                scale);

            float[] mSize = new float[2] { (float)mScreenRect.Width / (float)graphics.GraphicsDevice.Viewport.Width, (float)mScreenRect.Height / (float)graphics.GraphicsDevice.Viewport.Height };

            float mHeight = mScreenRect.Top;

            spriteBatch.Draw(mTrans, graphics.GraphicsDevice.Viewport.Bounds, Color.White);
            //spriteBatch.Draw(mTitle, new Rectangle(mScreenRect.Center.X - (int)(mTitle.Width * mSize[0]) / 2, mScreenRect.Top, (int)(mTitle.Width * mSize[0]), (int)(mTitle.Height * mSize[1])), Color.White);

            string request = "Goals for " + level.Name + ":";

            Vector2 stringSize = mQuartzLarge.MeasureString(request);
            spriteBatch.DrawString(mQuartzLarge, request, new Vector2(mScreenRect.Center.X - stringSize.X / 2, mHeight), Color.DarkTurquoise);
            spriteBatch.DrawString(mQuartzLarge, request, new Vector2(mScreenRect.Center.X - stringSize.X / 2 + 2, mHeight + 2), Color.White);

            mHeight += (mQuartzLarge.LineSpacing + mQuartzSmall.LineSpacing);

            request = "Gems:";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - stringSize.X / 2, mHeight), Color.DarkTurquoise);

            mHeight += mQuartzSmall.LineSpacing;

            /* Print the collectable goals for the level */
            if ((int)(level.NumCollectable * .8) - 1 != 0)
                request = " 0 - " + ((int)(level.NumCollectable * .8) - 1) + " gems";
            else
                request = " 0 gems";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - mScreenRect.Width / 3 - stringSize.X / 2, mHeight), Color.White);

            if ((level.NumCollectable - 1) != (int)(level.NumCollectable * .8))
                request = (int)(level.NumCollectable * .8) + " - " + (level.NumCollectable - 1).ToString() + " gems";
            else
                request = (int)(level.NumCollectable * .8) + " gems";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - stringSize.X / 2, mHeight), Color.White);

            request = level.NumCollectable.ToString() + " gems";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - stringSize.X / 2, mHeight), Color.White);

            mHeight += mQuartzSmall.LineSpacing;

            /* 1 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X - mScreenRect.Width / 3 - mStar.Width / 2, mHeight), Color.White);

            /* 2 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X - mStar.Width, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X, mHeight), Color.White);

            /* 3 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - 3*mStar.Width/2, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - mStar.Width / 2, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 + mStar.Width / 2, mHeight), Color.White);

            mHeight += (mStar.Height + mQuartzSmall.LineSpacing);

            request = "Time in seconds:";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - stringSize.X / 2, mHeight), Color.DarkTurquoise);

            mHeight += mQuartzSmall.LineSpacing;

            /* Print the timer goals for the level */
            request = "Over " + (int)(level.IdealTime * 1.2) + " secs";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - mScreenRect.Width / 3 - stringSize.X / 2, mHeight), Color.White);

            if((int)(level.IdealTime + 1) != (int)(level.IdealTime * 1.2))
                request = (int)(level.IdealTime + 1) + " - " + (int)(level.IdealTime * 1.2) + " secs";
            else
                request = (int)(level.IdealTime * 1.2) + " secs";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - stringSize.X / 2, mHeight), Color.White);

            request = (int)(level.IdealTime) +" secs";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - stringSize.X / 2, mHeight), Color.White);

            mHeight += mQuartzSmall.LineSpacing;

            /* 1 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X - mScreenRect.Width / 3 - mStar.Width / 2, mHeight), Color.White);

            /* 2 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X - mStar.Width, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X, mHeight), Color.White);

            /* 3 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - 3 * mStar.Width / 2, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - mStar.Width / 2, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 + mStar.Width / 2, mHeight), Color.White);

            mHeight += (mStar.Height + mQuartzSmall.LineSpacing);

            request = "Deaths:";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - stringSize.X / 2, mHeight), Color.DarkTurquoise);

            mHeight += mQuartzSmall.LineSpacing;

            /* Print the death goals for the level */
            request = " 3 - 5 Deaths";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - mScreenRect.Width / 3 - stringSize.X / 2, mHeight), Color.White);

            request = " 1 - 2 Deaths";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X - stringSize.X / 2, mHeight), Color.White);

            request = " 0 Deaths";

            stringSize = mQuartzSmall.MeasureString(request);
            spriteBatch.DrawString(mQuartzSmall, request, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - stringSize.X / 2, mHeight), Color.White);

            mHeight += mQuartzSmall.LineSpacing;
            /* 1 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X - mScreenRect.Width / 3 - mStar.Width / 2, mHeight), Color.White);

            /* 2 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X - mStar.Width, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X, mHeight), Color.White);

            /* 3 Star */
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - 3 * mStar.Width / 2, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 - mStar.Width / 2, mHeight), Color.White);
            spriteBatch.Draw(mStar, new Vector2(mScreenRect.Center.X + mScreenRect.Width / 3 + mStar.Width / 2, mHeight), Color.White);

            spriteBatch.End();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Handles when the A key is pressed
        /// </summary>
        private void HandleAKey(ref GameStates gameState, ref Level currentLevel)
        {
            if (mControls.isAPressed(false) || mControls.isStartPressed(false))
            {
                if (mShowCongrats)
                { mShowCongrats = false; return; }

                if (GameSound.volume != 0)
                    GameSound.menuSound_select.Play();

                if (mLevels[mCurrentWorld * 6 + mCurrentIndex].Unlocked)
                    mLoading = START_LOAD;
            #if XBOX360
                else if (TrialMode)
                {
                    gameState = GameStates.WorldPurchaseScreen;
                }
            #endif

                //Handle level select
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Handle any changes while on the level selection menu
        /// </summary>
        /// <param name="gameTime">Current time within the game</param>
        /// <param name="gameState">Current gamestate of the game</param>
        /// <param name="currentLevel">Current level of the game</param>
        public void Update(GameTime gameTime, ref GameStates gameState, ref Level currentLevel)
        {
            //Handle loading after loading screen has been drawn
            if (mLoading == LOADING)
            {
                mLoading = NONE;
                currentLevel = mLevels[mCurrentWorld * 6 + mCurrentIndex].Level;

                currentLevel.Load(mContent);

                currentLevel.IdealTime = mLevels[mCurrentWorld * 6 + mCurrentIndex].GetGoal(LevelInfo.StarTypes.Time);
                currentLevel.CollectableCount = mLevels[mCurrentWorld * 6 + mCurrentIndex].GetGoal(LevelInfo.StarTypes.Collection);

                currentLevel.TimerStar = mLevels[mCurrentWorld * 6 + mCurrentIndex].GetStar(LevelInfo.StarTypes.Time);
                currentLevel.CollectionStar = mLevels[mCurrentWorld * 6 + mCurrentIndex].GetStar(LevelInfo.StarTypes.Collection);
                currentLevel.DeathStar = mLevels[mCurrentWorld * 6 + mCurrentIndex].GetStar(LevelInfo.StarTypes.Death);

                gameState = GameStates.StartLevelSplash;
            }

            HandleAKey(ref gameState, ref currentLevel);
            HandleBKey(ref gameState);
            HandleDirectionKey();
        }
Ejemplo n.º 15
0
 public static Level MainMenuLevel(string filepath, IControlScheme controls, Viewport viewport, Rectangle region)
 {
     Level main = new Level(filepath, controls, viewport);
     main.isCameraFixed = true;
     main.shouldAnimate = false;
     main.Size = new Vector2(region.Width * 4 / 3, region.Height * 4 / 3);
     main.mStartingPoint = new Vector2(region.Width * 11 / 18, region.Height / 4);
     return main;
 }
Ejemplo n.º 16
0
        public void Update(GameTime gameTime, ref GameStates gameState, ref Level level)
        {
            /* If the user hits up */
            if (mControls.isUpPressed(false))
            {
                /* If we are not on the first element already */
                if (mCurrent > 0)
                {
                    GameSound.menuSound_rollover.Play(GameSound.volume, 0.0f, 0.0f);
                    /* Decrement current and change the images */
                    mCurrent--;
                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
            }
            /* If the user hits the down button */
            if (mControls.isDownPressed(false))
            {
                /* If we are on the last element in the menu */
                if (mCurrent < NUM_OPTIONS - 1)
                {
                    GameSound.menuSound_rollover.Play(GameSound.volume, 0.0f, 0.0f);
                    /* Increment current and update graphics */
                    mCurrent++;
                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
            }
            /* If the user selects a menu item */
            if (mControls.isAPressed(false) || mControls.isStartPressed(false))
            {
                GameSound.menuSound_select.Play(GameSound.volume, 0.0f, 0.0f);
                /* Continue */
                if (mCurrent == 0)
                {
                    gameState = GameStates.New_Level_Selection;
                    level.Reset();
                    mCurrent = 1;

                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
                /* Back */
                else if (mCurrent == 1)
                {
                    gameState = GameStates.Options;

                }
            }
        }
Ejemplo n.º 17
0
        public void Update(GameTime gametime, ref GameStates states, Level mainMenuLevel)
        {
            PhysicsEnvironment env = mainMenuLevel.Environment;
            if (mControls.isBackPressed(false) || mControls.isBPressed(false))
                states = GameStates.Main_Menu;

            if (mControls.isAPressed(false) || mControls.isStartPressed(false))
            {
                if (mCurrentChoice == MenuChoices.Volume)
                {
                    states = GameStates.SoundOptions;
                    mainMenuLevel.Reload();
                }
                if (mCurrentChoice == MenuChoices.Controls)
                {
                    states = GameStates.Controls;
                    mainMenuLevel.Reload();
                }
                if (mCurrentChoice == MenuChoices.Reset)
                {
                    states = GameStates.ResetConfirm;
                    mainMenuLevel.Reload();
                }
                if (mCurrentChoice == MenuChoices.Back)
                    states = GameStates.Main_Menu;

                env.GravityDirection = GravityDirections.Down;
            }

            if (env.GravityDirection == GravityDirections.Down)
                mCurrentChoice = MenuChoices.Controls;
            if (env.GravityDirection == GravityDirections.Left)
                mCurrentChoice = MenuChoices.Reset;
            if (env.GravityDirection == GravityDirections.Right)
                mCurrentChoice = MenuChoices.Volume;
            if (env.GravityDirection == GravityDirections.Up)
                mCurrentChoice = MenuChoices.Back;
        }