Example #1
0
        public Enemy(Player Player, SpriteBatch Sprite, ContentManager Content, string type, Collision Collision, int Index)
        {
            player = Player;
            sprite = Sprite;
            content = Content;
            collision = Collision;
            index = Index;

            loadEnemy(type);
            setEnemyStartingPosition();
            setStartingHealth();
        }
Example #2
0
        private void menuFunctions(GameTime gameTime)
        {
            switch (GlobalVars.currentState)
            {
                case GlobalVars.gameState.mainMenuStart:
                    {
                        menu.loadCaracterMenuKies();
                        menu.loadMainMenuHighscore();
                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.caracterMenuKies;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Down))
                        {
                            GlobalVars.currentState = GlobalVars.gameState.mainMenuHighscore;
                        }

                        break;
                    }

                case GlobalVars.gameState.mainMenuHighscore:
                    {
                            menu.loadHighscoreMenuTerug();
                            menu.loadMainMenuStart();
                            if (keystate.IsKeyDown(Keys.Enter))
                            {
                                if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                                {
                                    vorigmenu = gameTime.TotalGameTime;
                                    GlobalVars.currentState = GlobalVars.gameState.highScoreMenuTerug;
                                }
                            }
                            else if (keystate.IsKeyDown(Keys.Up))
                            {
                                GlobalVars.currentState = GlobalVars.gameState.mainMenuStart;
                            }
                        break;
                    }

                case GlobalVars.gameState.highScoreMenuTerug:
                    {
                        menu.loadMainMenuStart();
                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.mainMenuStart;
                            }
                        }

                        break;
                    }

                case GlobalVars.gameState.caracterMenuKies:
                    {
                            menu.loadCaracterMenuTerug();
                            menu.loadMoeilijkheidMenuKiesEasy();
                            if (keystate.IsKeyDown(Keys.Enter))
                            {
                                if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                                {
                                    vorigmenu = gameTime.TotalGameTime;
                                    GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuKiesEasy;
                                }
                            }
                            else if (keystate.IsKeyDown(Keys.Left))
                            {
                                GlobalVars.currentState = GlobalVars.gameState.caracterMenuTerug;
                            }

                        break;
                    }

                case GlobalVars.gameState.caracterMenuTerug:
                    {
                        menu.loadMainMenuStart();
                        menu.loadCaracterMenuKies();
                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.mainMenuStart;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Right))
                        {
                            GlobalVars.currentState = GlobalVars.gameState.caracterMenuKies;
                        }

                        break;
                    }

                case GlobalVars.gameState.moeilijkheidMenuKiesEasy:
                    {
                        menu.loadMoeilijkheidMenuKiesMedium();
                        menu.loadMoeilijkheidMenuTerugEasy();
                        level.loadLevel();

                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                GlobalVars.currentState = GlobalVars.gameState.displayingNormalLevel;

                                animation = new PlayerAnimation(Content, spriteBatch, "Luc");
                                player = new Player(level, animation);
                                collision = new Collision(animation, player, level);

                                animation.player = this.player;
                                level.player = this.player;
                                player.Collision = this.collision;

                                player.setStartingPosition();
                                vorigmenu = gameTime.TotalGameTime;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Down))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.3) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuKiesMedium;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Left))
                        {
                            GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuTerugEasy;
                        }

                        break;
                    }

                case GlobalVars.gameState.moeilijkheidMenuKiesMedium:
                    {
                        menu.loadMoeilijkheidMenuTerugMedium();
                        menu.loadMoeilijkheidMenuKiesHard();
                        level.loadLevel();
                        menu.loadMoeilijkheidMenuKiesEasy();

                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                GlobalVars.currentState = GlobalVars.gameState.displayingNormalLevel;

                                animation = new PlayerAnimation(Content, spriteBatch, "Luc");
                                player = new Player(level, animation);
                                collision = new Collision(animation, player, level);

                                animation.player = this.player;
                                level.player = this.player;
                                player.Collision = this.collision;
                                vorigmenu = gameTime.TotalGameTime;
                                player.setStartingPosition();
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Up))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.3) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuKiesEasy;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Down))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.3) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuKiesHard;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Left))
                        {
                            GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuTerugMedium;
                        }

                        break;
                    }

                case GlobalVars.gameState.moeilijkheidMenuKiesHard:
                    {
                        menu.loadMoeilijkheidMenuKiesMedium();
                        menu.loadMoeilijkheidMenuTerugHard();
                        level.loadLevel();

                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                GlobalVars.currentState = GlobalVars.gameState.displayingNormalLevel;

                                animation = new PlayerAnimation(Content, spriteBatch, "Luc");
                                player = new Player(level, animation);
                                collision = new Collision(animation, player, level);

                                animation.player = this.player;
                                level.player = this.player;
                                player.Collision = this.collision;
                                vorigmenu = gameTime.TotalGameTime;
                                player.setStartingPosition();
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Up))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.3) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuKiesMedium;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Left))
                        {
                            GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuTerugHard;
                        }

                        break;
                    }

                case GlobalVars.gameState.moeilijkheidMenuTerugEasy:
                    {
                        menu.loadCaracterMenuKies();
                        menu.loadMoeilijkheidMenuTerugMedium();
                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.caracterMenuKies;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Down))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.3) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuTerugMedium;
                            }
                        }

                        else if (keystate.IsKeyDown(Keys.Right))
                        {
                            GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuKiesEasy;
                        }
                        break;
                    }

                case GlobalVars.gameState.moeilijkheidMenuTerugMedium:
                    {
                        menu.loadMoeilijkheidMenuTerugEasy();
                        menu.loadMoeilijkheidMenuTerugHard();
                        menu.loadCaracterMenuKies();

                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.caracterMenuKies;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Up))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.3) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuTerugEasy;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Down))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.3) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuTerugHard;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Right))
                        {
                            GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuKiesMedium;
                        }
                        break;
                    }

                case GlobalVars.gameState.moeilijkheidMenuTerugHard:
                    {
                        menu.loadMoeilijkheidMenuKiesMedium();
                        menu.loadCaracterMenuKies();
                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.5) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.caracterMenuKies;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Up))
                        {
                            if (vorigmenu + TimeSpan.FromSeconds(0.3) <= gameTime.TotalGameTime)
                            {
                                vorigmenu = gameTime.TotalGameTime;
                                GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuTerugMedium;
                            }
                        }
                        else if (keystate.IsKeyDown(Keys.Right))
                        {
                            GlobalVars.currentState = GlobalVars.gameState.moeilijkheidMenuKiesHard;
                        }
                        break;
                    }

                case GlobalVars.gameState.levelScore:
                    {
                        level.loadLevel();
                        if (keystate.IsKeyDown(Keys.Enter))
                        {
                            vorigmenu = gameTime.TotalGameTime;
                            GlobalVars.currentState = GlobalVars.gameState.displayingNormalLevel;
                        }
                        break;
                    }
            }
        }