Example #1
0
        public Minimap(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, LevelOne levelMap, PlayerCamera playerCamera, Texture2D cameraTexture, Texture2D enemyTexture)
        {
            //Process minimap texture once, then when updating mini-map we only show the areas that need to be shown
            m_playerCamera = playerCamera;
            m_miniMapRectangle = new Rectangle(mapOriginX, mapOriginY, miniMapWidth, miniMapHeight);

            m_cameraTexture = cameraTexture;
            m_enemyTexture = enemyTexture;

            m_levelMap = levelMap;

            m_miniMapSprites = new List<Sprite>();

            m_msTimeInterval = 0;

            initializeMapRepresentation();
            initializeRenderTarget(spriteBatch, graphicsDevice);
        }
Example #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);
            // TODO: use this.Content to load your game content here

            //Load in player ship with bullet textures
            m_playerShip = new PlayerShip(Content.Load<Texture2D>("PlayerShip"), Content.Load<Texture2D>("Bullet"), Content.Load<Texture2D>("PlayerEnergy"));

            //Load in level one map with player, and required level textures, such as the asteroids, enemies, and enemy bullets
            //This is pretty hack, should probably call a LoadContent function within the level class, and initiate all required textures there.
            m_levelOne = new LevelOne(m_playerShip, Content.Load<Texture2D>("BasicBlueBackground"), Content.Load<Texture2D>("Asteroid"), Content.Load<Texture2D>("EnemyShip"), Content.Load<Texture2D>("EnemyBullet"));

            //Initialize player camera (focused on player)
            m_playerCamera = new PlayerCamera(GraphicsDevice.Viewport, 0.5f);

            //Load in mini map with level, camera, and required mini map textures such as... camera / enemies / allies
            //Mini-map needs handle to graphics device & spritebatch to initialize the map texture that will be drawn upon load
            m_miniMap = new Minimap(GraphicsDevice, spriteBatch, m_levelOne, m_playerCamera, Content.Load<Texture2D>("PlayerSphere"), Content.Load<Texture2D>("EnemySphere"));

            //Initialize collision engine, with ship, and level, and the minimap (to see if sprites should be displayed in the mini-map or not)
            m_collisionEngine = new Collision(this, m_levelOne, m_playerShip, m_miniMap);

            //Load in Screen management textures

            m_scrmngr_loadScreenText = Content.Load<Texture2D>("LoadingScreen");
            m_scrmngr_gameOverScreen = Content.Load<Texture2D>("GameOverScreen");
        }