Exemplo n.º 1
0
        public GameController(int windowX, int windowY)
        {
            //game controller will keep track of
            //player, enemies, score, items.
            player = new Player(3);
            diffContext = new DifficultyContext(player.PlayerScore);
            player.PlayerScore.register(diffContext);
            spawner = new SpawnerProto(windowX,windowY);

            enemiesVector = new List<Vector2>();
            enemiesOnScreen = new List<EnemySubclass>();

            notification = "";

            windowHeight = windowY;
            windowWidth = windowX;

            items = new ItemManager();
            itemAppeared = false;

            elapsedTime = 0;
        }
Exemplo n.º 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()
        {
            //our height and width of screen
            int height = graphics.GraphicsDevice.Viewport.Height;
            int width = graphics.GraphicsDevice.Viewport.Width;
            Ran = new Random();
            //use item
            player = new Player(3);
            //Handles game logic separate from Rendering
            controller = new GameController(graphics.GraphicsDevice.PresentationParameters.Bounds.Width, graphics.GraphicsDevice.PresentationParameters.Bounds.Height);
            //mouse and keyboard states
            currentKeyboardState = new KeyboardState();
            currentMouseState = new MouseState();

            //initialize cursor
            cursor = new Vector2(width, height);
            paused = false;
            pauseKeyDown = false;
            gameMenuUp = true;

            //initialize the vectors for things written on the screen
            scoreVector = new Vector2(width - 150, height - 40);
            livesVector = new Vector2(width - 300, height - 40);
            scoreVector = new Vector2(width - 450, height - 40);
            notificationVector = new Vector2(width - 850, height - 40);
            ammoVector = new Vector2(width - 1050 , height - 40);

            elapsedtime = 0.0;

            base.Initialize();
        }