/// <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(); }
/// <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"); }