Example #1
0
        public void UpdatePlayer(GameTime gameTime)
        {
            if (!IsBorn)
            {
                BornTime = gameTime.TotalGameTime;
                IsBorn   = true;
            }
            Age       = gameTime.TotalGameTime;
            DebugText = "Age: " + Age.Ticks + " Born: " + BornTime.Ticks;
            var time = BornTime.Add(new TimeSpan(0, 0, 3));

            if (Age > time)
            {
                IsDeadly = true;
            }
            Sprite.UpdateSprite(gameTime, CurrentPlayerDirection, GetType() != typeof(Enemy) || IsDeadly);

            SpritePosition.KeepSpriteOnScreen(Sprite, _graphicsDevice);

            _currentTimer = gameTime.TotalGameTime.TotalSeconds;

            _screenText.SetPosition((int)Sprite.Position.X, (int)Sprite.Position.Y - 50);
            if (JumpInProgress)
            {
                CheckIfStillJumping();
            }
        }
        public InformationPanel(Game game)
            : base(game)
        {
            _contentManager = game.Content;
            _timeText = new ScreenText(game);
            _timeText.SetPosition(1000, 50);

            _pointsText = new ScreenText(game);
            _pointsText.SetPosition(1000, 20);

            _contentManager = game.Content;
            CreateObject();
            Sprite.Position.X = 1100;
            Sprite.Position.Y = 50;
        }
        public InformationPanel(Game game)
            : base(game)
        {
            _contentManager = game.Content;
            _timeText       = new ScreenText(game);
            _timeText.SetPosition(1000, 50);

            _pointsText = new ScreenText(game);
            _pointsText.SetPosition(1000, 20);

            _contentManager = game.Content;
            CreateObject();
            Sprite.Position.X = 1100;
            Sprite.Position.Y = 50;
        }
        public GameOverScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D image)
            : base(game, spriteBatch)
        {
            _highScoreService = new PlexiIntegrationService();
            GetHighScoreFromLeaderBoard();
            IshighScore = false;
            _gameOverText = new BlinkText(spriteFont, 20);
            _gameOverText.SetPosition(555, 140);
            _gameOverText.SetSpacing(3);

            _pressSpaceToContinue = new BlinkText(spriteFont, 320);
            _pressSpaceToContinue.SetPosition(430, 670);

            _highScoreTableText = new ScreenText(game);
            _highScoreTableText.SetPosition(360, 250);

            _resultText = new ScreenText(game);
            _resultText.SetPosition(20, 130);

            _image = image;
            _imageRectangle = new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height);
        }