Exemple #1
0
        public void DrawFrame(SpriteBatch spriteBatch, MovingBackgroundAnimation backgroundAnimation, float elapsedGameTime, int screenHeight, int screenWidth, SpriteFont arialFont28)
        {
            backgroundAnimation.DrawFrame(elapsedGameTime, screenHeight);

            spriteBatch.Begin();
            spriteBatch.DrawString(arialFont28, "It seems you died...", new Vector2((screenWidth / 2) - 160, (screenHeight / 2) - 300), Color.Red);
            spriteBatch.End();

            upgradeButton.DrawButton();
            exitButton.DrawButton();
        }
Exemple #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()
        {
            //graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
            //graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            //graphics.IsFullScreen = true;
            //graphics.ApplyChanges();

            //graphics.PreferredBackBufferWidth = 1200;  // set this value to the desired width of your window
            //graphics.PreferredBackBufferHeight = 800;   // set this value to the desired height of your window
            graphics.PreferredBackBufferWidth  = 1920;
            graphics.PreferredBackBufferHeight = 1080;
            graphics.ApplyChanges();

            //Took it out as debugging is somehow hard with this!
            //graphics.ToggleFullScreen();

            screenWidth  = GraphicsDevice.Viewport.Width;
            screenHeight = GraphicsDevice.Viewport.Height;

            //this.Window.AllowUserResizing = true;
            //this.Window.Position = new Point(((GraphicsDevice.DisplayMode.Width / 2) - screenWidth /2), ((GraphicsDevice.DisplayMode.Height / 2) - screenHeight / 2));


            //Create and Load Player
            player = new PlayerClass();
            initialPlayerPosition = new Vector2(screenWidth / 2, screenHeight - 200);


            //Create the Background
            backgroundAnimation = new MovingBackgroundAnimation();


            //Create Start Menu Screen
            startMenuScreen   = new StartMenuScreen();
            gameOverScreen    = new GameOverScreen();
            upgradeMenuScreen = new UpgradeMenuScreen();

            //Load Event Listener

            //Enemy Destroyed Listener
            //enemyDAL = new EnemyDestroyedAnimationListener();

            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            enemies          = new List <EnemyClass>();
            spawnTimeCounter = 0;
            enemySpawnTime   = 2.0f;
            random           = new Random();


            base.Initialize();
        }