예제 #1
0
        /// <summary>
        /// Updates all of the players logic
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            invulnerabilityFrames -= gameTime.ElapsedGameTime.Milliseconds;
            UpdateControls(gameTime);
            UpdateAnimation(gameTime);
            UpdatePosition(gameTime);
            if (attacking)
            {
                UpdateAttack(gameTime);
            }
            UpdateVelocity(gameTime);
            HealthDepletion(gameTime);

            if (Health <= 0)
            {
                HighScore.SaveHighScore(new HighScoreEntry(playerName, InGame.totalTimeElapsed));
                GameOver.UpdatePlayerScore(playerName, InGame.totalTimeElapsed);
                Game1.GameState = Game1.GameStates.GameOver;
            }
        }
예제 #2
0
        /// <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);


            NormalMenuFont = Content.Load <SpriteFont>(@"Fonts/NormalMenuFont");
            BoldMenuFont   = Content.Load <SpriteFont>(@"Fonts/BoldMenuFont");

            CreditsFont      = Content.Load <SpriteFont>(@"Fonts/CreditsFont");
            BoldCreditsFont  = Content.Load <SpriteFont>(@"Fonts/BoldCreditsFont");
            CreditsTitleFont = Content.Load <SpriteFont>(@"Fonts/CreditsTitleFont");

            MainMenu.LoadContent(Content);
            InGame.LoadContent(Content, GraphicsDevice);
            Tutorial.LoadContent(Content, GraphicsDevice);
            HighScore.LoadContent(Content);
            Credits.LoadContent(Content, GraphicsDevice);
            GameOver.LoadContent(Content);

            GameState = GameStates.MainMenu;
        }