Exemplo n.º 1
0
        public void update(GameTime gameTime, Player player)
        {
            for (int i = 0; i < layerContents.Length; i++)
            {
                if (player.Destination.Center.X * m_ParallaxSpeed >= layerContents[i].Bounds.X && player.Destination.Center.X * m_ParallaxSpeed <= layerContents[i].Bounds.Right)
                {
                    layerContents[i].isActive = true;
                }
                else
                {
                    layerContents[i].isActive = false;
                }

            }

            if(layerContents[(int)LayerNames.A].isActive)
            {
                layerContents[(int)LayerNames.B].position.X = layerContents[(int)LayerNames.A].Bounds.Right;
                layerContents[(int)LayerNames.C].position.X = layerContents[(int)LayerNames.A].Bounds.Left - layerContents[(int)LayerNames.A].Bounds.Width;
            }

            if (layerContents[(int)LayerNames.B].isActive)
            {
                layerContents[(int)LayerNames.C].position.X = layerContents[(int)LayerNames.B].Bounds.Right;
                layerContents[(int)LayerNames.A].position.X = layerContents[(int)LayerNames.B].Bounds.Left - layerContents[(int)LayerNames.B].Bounds.Width;
            }

            if (layerContents[(int)LayerNames.C].isActive)
            {
                layerContents[(int)LayerNames.A].position.X = layerContents[(int)LayerNames.C].Bounds.Right;
                layerContents[(int)LayerNames.B].position.X = layerContents[(int)LayerNames.C].Bounds.Left - layerContents[(int)LayerNames.C].Bounds.Width;
            }
        }
Exemplo n.º 2
0
 public void update(GameTime gameTime, Player player)
 {
     foreach (Background background in m_Backgrounds)
     {
         background.update(gameTime, player);
     }
 }
Exemplo n.º 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
        }
Exemplo n.º 4
0
 public void update(GameTime gameTime, Player player)
 {
     for (int i = 0; i < m_Layers.Length; i++)
     {
         m_Layers[i].update(gameTime, player);
     }
 }