Пример #1
0
 public void draw(SpriteBatch spriteBatch, Camera camera)
 {
     for (int i = 0; i < m_Backgrounds.Count; i++)
     {
         m_Backgrounds[i].draw(spriteBatch, camera);
     }
 }
Пример #2
0
        public Background(Camera camera)
        {
            Parallax1 = Vector2.One;
            Parallax2 = Vector2.One;
            Parallax3 = Vector2.One;
            Parallax4 = Vector2.One;

            layers = new List<Layer>();
            m_Layers = new Layer[4];

            for (int i = 0; i < m_Layers.Length; i++)
            {
                m_Layers[i] = new Layer();
            }
        }
Пример #3
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);

            //stuff to change screen size / fullscreen
            graphics.PreferredBackBufferWidth = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Sounds.loadContent(Content);
            BackgroundMusic.loadContent(Content);
            IsMouseVisible = true;

            hud = new Hud();
            hud.LoadContent(Content);

            screenManager = new ScreenManager();
            screenManager.LoadContent(Content, graphics);

            gateManager = new GateManager();
            m_EnemyManager = new EnemyManager();
            pickupManager = new PickUpManager();
            tiles = new Level(new Rectangle(0, 0, 32, 32), new Rectangle(0, 0, 32, 32));
            tiles.loadContent(Content, "EnchantedForestTileSetUpdated", "Content/Level0.txt");

            EnemyManager.loadContent(Content);
            PickUpManager.loadContent(Content);
            GateManager.loadContent(Content);
            player = new Player( new Vector2(200, 1000),new Rectangle(0, 0, 128, 64), new Rectangle(0, 0, 128,64 ));
            player.loadContent(Content);

            camera = new Camera(GraphicsDevice.Viewport);
            camera.Limits = new Rectangle(0, 0, Level.getWidthOfArray() * tiles.Destination.Width, Level.getHeightOfArray() * tiles.Destination.Height);

            background1 = new Background(camera);
            Background.loadContent(Content, Level.levelCount, 1);
            background1.setParallaxes();

            backgroundManager = new BackgroundManager();
            backgroundManager.addBackground(background1);

            boss = new Boss();
            boss.loadContent(Content);
            // TODO: use this.Content to load your game content here
        }
Пример #4
0
        public void draw(SpriteBatch spriteBatch, Camera camera)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.getParallaxMatrix(Parallax1));
            m_Layers[0].draw(spriteBatch);
            spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.getParallaxMatrix(Parallax2));
            m_Layers[1].draw(spriteBatch);
            spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.getParallaxMatrix(Parallax3));
            m_Layers[2].draw(spriteBatch);
            spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.getParallaxMatrix(Parallax4));
            m_Layers[3].draw(spriteBatch);
            spriteBatch.End();
        }