Esempio n. 1
0
        private void NewGame()
        {
            _camera = new Simple2DCamera(_window);

            var gameOverTexture = _graphics.CreateTexture("assets/textures/gameover.png", TextureData.Default);

            _gameOver = new Sprite(gameOverTexture, 0, 0, _window.Width / 3, _window.Height / 6);

            Ground     = _window.Height / 6;
            _obstacles = new List <Obstacle>();

            var speed = Ground / 7;

            _player = new Player
            {
                X      = Ground,
                Y      = Ground + (int)(_window.Width / 12.5) / 2,
                Width  = (int)(_window.Width / 12.5),
                Height = (int)(_window.Width / 12.5),
                Color  = Color.White,

                RunSpeed   = speed,
                JumpSpeed  = speed,
                FallSpeed  = speed,
                JumpHeight = Ground * 2 + speed,
                State      = PlayerState.IsFalling
            };

            Run();
        }