예제 #1
0
 public void GoToLevel2()
 {
     Console.WriteLine("volgende level begiint");
     heroRight._position = Vector2.Zero;
     heroLeft._position  = Vector2.Zero;
     map.ClearMap();
     map.DrawLevel2();
     ClearCoins();
     AddCoinsLevel2();
     ladder.isVisible = false;
     key           = new Sprite(keyTexture, new Vector2(685, 95));
     restoreHealth = new Sprite(healthTexture, new Vector2(750, 95));
     enemiesLevel1.Clear();
     enemiesLevel1.Add(new Enemy(enemy1RightTexture, new Vector2(510, 0)));
     enemiesLevel1.Add(new Enemy(enemy1RightTexture, new Vector2(1130, 0)));
     enemiesLevel1[0].isVisible = false;
     enemiesLevel1[1].isVisible = false;
     enemiesLevel2.Add(new Enemy(enemy1RightTexture, new Vector2(510, 0)));
     enemiesLevel2[0].MoveEnemyAround(780, 510);
     door               = new Door(doorTexture, new Vector2(1770, 600));
     mainBoss           = new MainBoss(mainBossTexture, new Vector2(1600, 0));
     mainBoss.isVisible = true;
 }
예제 #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()
        {
            camera.Position = camPos;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch  = new SpriteBatch(GraphicsDevice);
            Tile.Content = Content;

            //SCREEN
            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            graphics.ApplyChanges();


            //BUTTON
            btnPlayTexture = Content.Load <Texture2D>("buttons/btnPlay");
            btnPlay        = new Button(btnPlayTexture, graphics.GraphicsDevice);
            btnPlay.setPosition(new Vector2(-50, 750));

            btnInstructionTexture = Content.Load <Texture2D>("buttons/btnInstructions");
            btnInstruction        = new Button(btnInstructionTexture, graphics.GraphicsDevice);
            btnInstruction.setPosition(new Vector2(1300, 750));

            btnBackTexture = Content.Load <Texture2D>("buttons/btnBack");
            btnBack        = new Button(btnBackTexture, graphics.GraphicsDevice);
            btnBack.setPosition(new Vector2(-100, 0));
            btnBack._rectangle = new Rectangle(0, 0, 25, 25);

            btnPlayAgainTexture = Content.Load <Texture2D>("buttons/btnPlayAgain");
            btnPlayAgain        = new Button(btnPlayAgainTexture, graphics.GraphicsDevice);
            btnPlayAgain.setPosition(new Vector2(960, 525));



            //SOUNDTRACKS
            soundEffect     = Content.Load <SoundEffect>("soundTracks/jump");
            backgroundMusic = Content.Load <Song>("soundTracks/background");
            for (int i = 0; i < 100; i++)
            {
                MediaPlayer.Play(backgroundMusic);
            }


            //HEALTHBAR
            healthBarRedTexture   = Content.Load <Texture2D>("healthBarRed");
            healthBarGreenTexture = Content.Load <Texture2D>("healthBarGreen");


            //HEALTH
            healthTexture = Content.Load <Texture2D>("health");

            //HERO
            heroRightTexture   = Content.Load <Texture2D>("boy/heroRight");
            heroRight          = new Hero(heroRightTexture, new Vector2(0, 0), heroLeftTexture, heroRightTexture, 100);
            heroRight._control = new ControlsArrows();

            heroLeftTexture   = Content.Load <Texture2D>("boy/heroLeft");
            heroLeft          = new Hero(heroLeftTexture, new Vector2(0, 0), heroLeftTexture, heroRightTexture, 100);
            heroLeft._control = new ControlsArrows();


            //ENEMY
            enemy1RightTexture = Content.Load <Texture2D>("enemy/enemyRight");

            enemiesLevel1.Add(new Enemy(enemy1RightTexture, new Vector2(510, 0)));
            enemiesLevel1.Add(new Enemy(enemy1RightTexture, new Vector2(1130, 0)));


            //COIN
            coinTexture = Content.Load <Texture2D>("coin");

            //SCORE COIN
            coins.Add(new Coin(coinTexture, new Vector2(0, 0)));


            //MAINBOSS
            mainBossTexture = Content.Load <Texture2D>("enemy/mainboss");
            mainBoss        = new MainBoss(mainBossTexture, new Vector2(1600, 0));



            //COIN
            AddCoinsLevel1();


            //Go to next level
            goToNextLevelTexture = Content.Load <Texture2D>("gotonextlevel");
            goToLevel2           = new Sprite(goToNextLevelTexture, new Vector2(1800, 697));



            //SCORE
            scoreFont = Content.Load <SpriteFont>("fonts/scoreFont");
            scorePos  = new Vector2(35, 0);
            score     = new Score(scoreFont, scorePos);

            finalScoreFont = Content.Load <SpriteFont>("fonts/finalScore");
            finalScorePos  = new Vector2(200, 200);
            finalScore     = new Score(finalScoreFont, finalScorePos);



            //BACKGROUND
            backgroundTexture = Content.Load <Texture2D>("background/bgLevel2");
            background        = new Background(backgroundTexture, new Vector2(GraphicsDevice.Viewport.X, GraphicsDevice.Viewport.Y
                                                                              ), new Rectangle(GraphicsDevice.Viewport.X, GraphicsDevice.Viewport.Y, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height));


            //LADDER
            ladderTexture = Content.Load <Texture2D>("ladder");
            ladder        = new Ladder(ladderTexture, new Vector2(0, 0), new Rectangle(475, 595, 150, 150));



            //MAP
            map.DrawLevel1();

            //BULLET
            bulletTexture = Content.Load <Texture2D>("bullet");
            bullets.Add(new Bullet(bulletTexture));

            //KEY
            keyTexture = Content.Load <Texture2D>("key");
            key        = new Sprite(keyTexture, new Vector2(0, 1500));

            //RESTORE HEALTH
            restoreHealth = new Sprite(healthTexture, new Vector2(0, 1500));

            //DOOR
            doorTexture = Content.Load <Texture2D>("door");
            door        = new Door(doorTexture, new Vector2(0, 1500));

            // TODO: use this.Content to load your game content here
        }