Exemplo n.º 1
0
 public static void LoadResources()
 {
     bonus   = new SFML.Graphics.Texture("Resources/sphere.png");
     LifeBar = new Dictionary <string, Texture>();
     LifeBar.Add("0", new SFML.Graphics.Texture("Resources/0.png"));
     LifeBar.Add("1", new SFML.Graphics.Texture("Resources/1.png"));
     LifeBar.Add("2", new SFML.Graphics.Texture("Resources/2.png"));
     LifeBar.Add("3", new SFML.Graphics.Texture("Resources/3.png"));
     LifeBar.Add("4", new SFML.Graphics.Texture("Resources/4.png"));
     LifeBar.Add("5", new SFML.Graphics.Texture("Resources/5.png"));
     LifeBar.Add("6", new SFML.Graphics.Texture("Resources/6.png"));
     LifeBar.Add("7", new SFML.Graphics.Texture("Resources/7.png"));
     LifeBar.Add("8", new SFML.Graphics.Texture("Resources/8.png"));
     LifeBar.Add("9", new SFML.Graphics.Texture("Resources/9.png"));
     LifeBar.Add("Full", new SFML.Graphics.Texture("Resources/Full.png"));
     Bosses = new Dictionary <String, Texture>();
     Bosses.Add("Boss1", new SFML.Graphics.Texture("Resources/Boss1.png"));
     Bosses.Add("Boss2", new SFML.Graphics.Texture("Resources/Boss2.png"));
     Bosses.Add("Boss3", new SFML.Graphics.Texture("Resources/Boss3.png"));
     Bosses.Add("Boss4", new SFML.Graphics.Texture("Resources/Boss4.png"));
     Bosses.Add("Boss5", new SFML.Graphics.Texture("Resources/Boss5.png"));
     Texture = new List <SFML.Graphics.Texture>();
     Texture.Add(new Texture("Resources/Crux_(Southern_Cross)_from_Hobart,_Tasmania.jpg"));
     Texture.Add(new SFML.Graphics.Texture(new SFML.Graphics.Texture("Resources/Spaceship.png")));
     Texture.Add(new Texture("Resources/BackGround.png"));
     Texture.Add(new SFML.Graphics.Texture("Resources/EnemySpaceShip.png"));
     menuItem     = new Texture("Resources/Menu1.png");
     font         = new Font("Resources/Gravity-Regular.otf");
     TextureRects = new Dictionary <string, IntRect>()
     {
         ["missile1"] = new IntRect(448, 419, 6, 10),
         ["RoundButtonUnpressed_444"] = new IntRect(514, 514, 128, 128),
         ["BG"]       = new IntRect(0, 0, 600, 418),
         ["Untitled"] = new IntRect(387, 419, 60, 70),
     };
     MainMenu.LoadMenuResources();
     MainMenu.CreateMenu();
     LoseMenu.LoadResources();
     LoseMenu.CreateMenu();
     AboutMenu.Init();
     AboutMenu.CreateMenu();
     Victory.Init();
     Victory.Show();
 }
Exemplo n.º 2
0
        public static void Menu()
        {
            switch (ActiveMenu)
            {
            case 1:
            {
                FinalWave = false;
                MainMenu.Draw(Program.window);
                MainMenu.ActiveMenu();
                PlayerOn    = false;
                LoseMenu.On = false;
                LoseMenu.isActive();
                break;
            }

            case 2:
            {
                Score.Draw(Program.window);
                if (!PlayerOn)
                {
                    PlayerOn = true;
                    Program.world.AddObject(new Player());
                    Program.world.AddObject(new PlayerLife());
                    CreateEnemyShips(x, y, 100, 0);
                    if (y < 21)
                    {
                        y += x;
                        if (y == 20)
                        {
                            y = 8;
                            x++;
                        }
                        if (x == 5)
                        {
                            x = 2;
                        }
                    }
                    Wave++;
                }
                if (Program.world.AllDestroyed() && FinalWave)
                {
                    ActiveMenu = 5;
                }
                else if (Program.world.AllDestroyed())
                {
                    switch (Wave % 6)
                    {
                    case 0:
                    {
                        Wave++;
                        if (BossCount == 5)
                        {
                            Program.world.AddObject(new FinalBoss());
                            FinalWave = true;
                            CreateEnemyShips(x, y, 100, 0);
                            if (y < 21)
                            {
                                y += x;
                                if (y == 20)
                                {
                                    y = 8;
                                    x++;
                                }
                                if (x == 5)
                                {
                                    x = 2;
                                }
                            }
                        }
                        else
                        {
                            Program.world.AddObject(new Boss());
                        }
                        BossCount++;
                        break;
                    }

                    case 1:
                    {
                        Wave++;
                        CreateEnemyShips(x, y, 100, 0);
                        if (lowLimit > 100)
                        {
                            lowLimit -= 10;
                        }
                        if (highLimit > 1000)
                        {
                            highLimit -= 300;
                        }
                        if (y < 21)
                        {
                            y += x;
                            if (y == 20)
                            {
                                y = 8;
                                x++;
                            }
                            if (x == 5)
                            {
                                x = 2;
                            }
                        }
                        break;
                    }

                    case 2:
                    {
                        Wave++;
                        CreateEnemyShips(x, y, 100, 0);
                        if (y < 21)
                        {
                            y += x;
                            if (y == 20)
                            {
                                y = 8;
                                x++;
                            }
                            if (x == 5)
                            {
                                x = 2;
                            }
                        }
                        break;
                    }

                    case 3:
                    {
                        Wave++;
                        CreateEnemyShips(x, y, 100, 0);
                        if (y < 21)
                        {
                            y += x;
                            if (y == 20)
                            {
                                y = 8;
                                x++;
                            }
                            if (x == 5)
                            {
                                x = 2;
                            }
                        }
                        break;
                    }

                    case 4:
                    {
                        Wave++;
                        CreateEnemyShips(x, y, 100, 0);
                        if (y < 21)
                        {
                            y += x;
                            if (y == 20)
                            {
                                y = 8;
                                x++;
                            }
                            if (x == 5)
                            {
                                x = 2;
                            }
                        }
                        break;
                    }

                    case 5:
                    {
                        Wave++;
                        CreateEnemyShips(x, y, 100, 0);
                        if (y < 21)
                        {
                            y += x;
                            if (y == 20)
                            {
                                y = 8;
                                x++;
                            }
                            if (x == 5)
                            {
                                x = 2;
                            }
                        }
                        break;
                    }

                    default:
                        break;
                    }
                }
                break;
            }

            case 3:
            {
                Program.world.EndGame();
                LoseMenu.update();
                LoseMenu.Draw(Program.window);
                LoseMenu.On = true;
                LoseMenu.isActive();
                break;
            }

            case 4:
            {
                AboutMenu.Draw(Program.window);
                break;
            }

            case 5:
            {
                Program.world.EndGame();
                Victory.Draw(Program.window);
                break;
            }

            default:
                break;
            }
        }