Example #1
0
        protected override void Update(GameTime gameTime)
        {
            currentKeyboardState = Keyboard.GetState();

            //Als gebruiker in het hoofdmenu zit
            if (gameState == GameState.mainmenu)
                mainMenu.Update(gameTime, currentKeyboardState, previousKeyboardState);
            else if (gameState == GameState.options) //Als gebruiker in optiemenu zit
            {
                optionsMenu.Update(gameTime, currentKeyboardState, previousKeyboardState);
            }
            else if (gameState == GameState.levelMenu)
            {
                levelMenu.Update(gameTime, currentKeyboardState, previousKeyboardState);
            }
            else if (gameState == GameState.running) //Als gebruiker level1 speelt
            {
                if (currentKeyboardState.IsKeyDown(Keys.Escape)) //Ga naar het startscherm als de "escape"-toets wordt ingedrukt
                    gameState = GameState.mainmenu;

                currentLevel.Update(gameTime, currentKeyboardState, previousKeyboardState);

                if (projectiles != null)
                    UpdateProjectiles();

                if (Character.deathTimer > 2500)
                {
                    gameState = GameState.dead;
                }
            }
            else if (gameState == GameState.dead)
                deathScreen.Update(gameTime, currentKeyboardState, previousKeyboardState);

            if (currentKeyboardState.IsKeyDown(Keys.R))
            {
                level1 = new Level1(this.Content, this, level1);
            }

            // Status van toetsenbord van vorige doorloop opslaan
            previousKeyboardState = currentKeyboardState;

            base.Update(gameTime);
        }
Example #2
0
 public Scrollen(Game1 game, Level1 Level1)
     : base(game)
 {
     this.level1 = Level1;
 }
Example #3
0
        protected override void Initialize()
        {
            mainMenu = new MainMenu(this.Content, this);
            optionsMenu = new OptionsMenu(this.Content, this);
            levelMenu = new LevelMenu(this.Content, this);
            deathScreen = new DeathScreen(this.Content, this);

            //Laad textures van character. Dit staat hier en niet in LoadContent, omdat ze al in het menu gebruikt worden, die in Initialize staat.
            character1Texture = this.Content.Load<Texture2D>("character1");
            character2Texture = this.Content.Load<Texture2D>("character2");
            character3Texture = this.Content.Load<Texture2D>("character3");

            level1 = new Level1(this.Content, this, level1);
            level2 = new Level2(this.Content, this);
            level3 = new Level3(this.Content, this);

            level1.Initialize();
            level2.Initialize();
            level3.Initialize();

            projectiles = new List<Projectile>();

            //// Game Components opnemen
            Components.Add(new Scrollen(this, level1));
            Components.Add(new health(this));
            Components.Add(new score(this));
            Components.Add(new coins(this));

            base.Initialize();
        }
Example #4
0
        public Level1(ContentManager content, Game1 game1, Level1 level1)
        {
            this.game = game1;

            character = new Character(game1); //"game1" omdat character een constructor heeft
        }