Exemple #1
0
    void CheckUserInput()
    {
        if (SdlHardware.KeyPressed(SdlHardware.KEY_Q))
        {
            finished = true;
        }

        if (SdlHardware.KeyPressed(SdlHardware.KEY_H))
        {
            HelpScreen help = new HelpScreen();
            help.Run();
        }

        if (canThrowDice)
        {
            if (SdlHardware.KeyPressed(SdlHardware.KEY_D))
            {
                // Wait if key D is pressed
                while (SdlHardware.KeyPressed(SdlHardware.KEY_D))
                {
                }
                ChangeTurn();
            }
        }
    }
    public static void Main(string[] args)
    {
        bool fullScreen = false;

        SdlHardware.Init(960, 750, 24, fullScreen);

        WelcomeScreen w = new WelcomeScreen();

        do
        {
            w.Run();
            if (w.GetChosenOption() == 1)
            {
                Game g = new Game();
                g.Run();
            }
            else if (w.GetChosenOption() == 2)
            {
                HelpScreen help = new HelpScreen();
                help.Run();
            }
            else if (w.GetChosenOption() == 3)
            {
                CreditsScreen credits = new CreditsScreen();
                credits.Run();
            }
        } while (w.GetChosenOption() != 4);
    }
Exemple #3
0
    public static void Main()
    {
        bool fullScreen = false;

        SdlHardware.Init(1024, 720, 24, fullScreen);

        WelcomeScreen w = new WelcomeScreen();

        do
        {
            w.Run();
            if (w.GetChosenOption() == 1)
            {
                Game g = new Game();
                g.Run();
            }
            else if (w.GetChosenOption() == 2)
            {
                CreditsScreen credits = new CreditsScreen();
                credits.Run();
            }
            else if (w.GetChosenOption() == 3)
            {
                HelpScreen help = new HelpScreen();
                help.Run();
            }
            else if (w.GetChosenOption() == 4)
            {
                ScoreBoard sb = new ScoreBoard();
                sb.Run();
            }
        } while (w.GetChosenOption() != 5);
    }
    static void Main()
    {
        bool fullScreen = false;

        SdlHardware.Init(1024, 768, 24, fullScreen);

        WelcomeScreen w = new WelcomeScreen();

        do
        {
            w.Run();
            if (w.GetChosenOption() == WelcomeScreen.OPTION_PLAY)
            {
                Game g = new Game();
                g.Run();
            }
            else if (w.GetChosenOption() == WelcomeScreen.OPTION_HELP)
            {
                HelpScreen help = new HelpScreen();
                help.Run();
            }
            else if (w.GetChosenOption() == WelcomeScreen.OPTION_CREDITS)
            {
                CreditsScreen credits = new CreditsScreen();
                credits.Run();
            }
        }while (w.GetChosenOption() != WelcomeScreen.OPTION_QUIT);
    }
Exemple #5
0
    public void Start()
    {
        Hardware             hardware = new Hardware(1024, 720, 24, false);
        WelcomeScreen        welcome  = new WelcomeScreen(hardware);
        LanguageSelectScreen languaje = new LanguageSelectScreen(hardware);

        welcome.Run();
        languaje.Run();
        MenuScreen menu = new MenuScreen(hardware, languaje.languaje);

        do
        {
            GameScreen    game    = new GameScreen(hardware);
            HelpScreen    help    = new HelpScreen(hardware, languaje.languaje);
            StatsScreen   stats   = new StatsScreen(hardware, languaje.languaje);
            CreditsScreen credits = new CreditsScreen(hardware, languaje.languaje);

            Player   p = Player.GetPlayer();
            DateTime begin;
            DateTime timeEnd;

            hardware.ClearScreen();
            menu.exit   = false;
            menu.option = -1;
            Console.WriteLine("Menu");
            menu.Run();

            switch (menu.option)
            {
            case 0:
                help.Run();
                begin = DateTime.Now;
                game.Run();
                timeEnd = DateTime.Now;
                TimeSpan       time = timeEnd - begin;
                GameOverScreen end  = new GameOverScreen(hardware, time, languaje.languaje);
                end.Run();
                break;

            case 1:
                stats.Run();
                break;

            case 2:
                credits.Run();
                break;
            }
            Thread.Sleep(50);
        } while (menu.option != 3 ||
                 hardware.IsKeyPressed(Hardware.KEY_ESC));
    }
Exemple #6
0
    public void Run()
    {
        Console.WriteLine("Welcome");
        Console.WriteLine("1-Game");
        Console.WriteLine("2-Help");
        Console.WriteLine("3-Demo");
        Console.WriteLine("ESC-Quit");
        ConsoleKeyInfo key = Console.ReadKey();

        switch (key.Key)
        {
        case ConsoleKey.D1: Game g = new Game(); g.Run(); break;

        case ConsoleKey.D2: HelpScreen h = new HelpScreen(); h.Run(); break;

        case ConsoleKey.D3: DemoScreen d = new DemoScreen(); d.Run(); break;
        }
    }
Exemple #7
0
    static void Main()
    {
        Inicialize();

        SdlHardware.Init(1200, 768, 24, FullScreen);
        WelcomeScreen w = new WelcomeScreen();

        os = new OptionsScreen();
        LoadGamesScreen lg = new LoadGamesScreen();
        HelpScreen      hs = new HelpScreen();

        int option;

        do
        {
            option = w.Run();
            switch (option)
            {
            case 0: break;

            case 1: g = new Game();  g.Run();
                break;

            case 2:
                if (lg.Run() == 0)
                {
                    g.Run();
                }
                break;

            case 3: os.Run();
                SaveOptions();
                SdlHardware.Init(1200, 768, 24, FullScreen);
                break;

            case 4: hs.Run();
                break;
            }
        } while (option != 5);
    }
Exemple #8
0
    void CheckUserInput()
    {
        if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC))
        {
            if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT))
            {
                player.JumpRight(room);
            }
            else if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT))
            {
                player.JumpLeft(room);
            }
            else
            {
                player.Jump(room);
            }
        }


        if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT))
        {
            player.MoveRight(room);
        }
        if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT))
        {
            player.MoveLeft(room);
        }

        if (SdlHardware.KeyPressed(SdlHardware.KEY_H))
        {
            HelpScreen help = new HelpScreen();
            help.Run();
        }

        if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC))
        {
            finished = true;
        }
    }
Exemple #9
0
    public void Run()
    {
        // TO DO: Create a real Menu, instead of showing all the screens

        IntroScreen intro = new IntroScreen();

        intro.Run();

        MenuScreen menu = new MenuScreen();

        do
        {
            menu.Run();
            switch (menu.GetChosenOption())
            {
            case MenuScreen.MenuOption.Game:
                Game g = new Game(menu.RetroLook);
                g.Run();
                break;

            case MenuScreen.MenuOption.Help:
                HelpScreen help = new HelpScreen(menu.RetroLook);
                help.Run();
                break;

            case MenuScreen.MenuOption.Credits:
                CreditsScreen credits = new CreditsScreen(menu.RetroLook);
                credits.Run();
                break;

            case MenuScreen.MenuOption.Scores:
                HiScoresScreen hiScores = new HiScoresScreen(menu.RetroLook);
                hiScores.Run();
                break;
            }
        } while (menu.GetChosenOption() != MenuScreen.MenuOption.Exit);
    }
        static void Main(string[] args)
        {
            bool fullScreen = false;

            Hardware.Init(1024, 768, 24, fullScreen);
            bool finished = false;

            while (!finished)
            {
                WelcomeScreen welcome = new WelcomeScreen();
                welcome.Run();
                CreditsScreen credits = new CreditsScreen();
                HelpScreen    help    = new HelpScreen();
                if (welcome.GetOptionChosen() == WelcomeScreen.options.Play)
                {
                    Game myGame = new Game();
                    myGame.Run();

                    GameOverScreen gameEnd = new GameOverScreen();
                    gameEnd.Run();
                }

                if (welcome.GetOptionChosen() == WelcomeScreen.options.Quit)
                {
                    finished = true;
                }
                if (welcome.GetOptionChosen() == WelcomeScreen.options.Credits)
                {
                    credits.Run();
                }
                if (welcome.GetOptionChosen() == WelcomeScreen.options.Help)
                {
                    Game myGame = new Game();
                    help.Run();
                }
            }
        }
Exemple #11
0
    public static void Main(string[] args)
    {
        SdlHardware.Init(1280, 720, 24, false);

        LoadingScreen ls = new LoadingScreen();

        ls.Run();

        WelcomeScreen welcome = new WelcomeScreen();

        do
        {
            welcome.Run();
            if (welcome.GetChosenOption() == WelcomeScreen.OPTION_PLAY)
            {
                Game g = new Game();
                g.Run();
                EndScreen end = new EndScreen();
                end.Run();
            }
            else if (welcome.GetChosenOption() == WelcomeScreen.OPTION_HELP)
            {
                HelpScreen help = new HelpScreen();
                help.Run();
            }
            else if (welcome.GetChosenOption() == WelcomeScreen.OPTION_CREDITS)
            {
                CreditsScreen credits = new CreditsScreen();
                credits.Run();
            }
            else if (welcome.GetChosenOption() == WelcomeScreen.OPTION_CONFIG)
            {
                ConfigScreen config = new ConfigScreen();
                config.Run();
            }
        }while (welcome.GetChosenOption() != WelcomeScreen.OPTION_QUIT);
    }
Exemple #12
0
    void CheckUserInput()
    {
        if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT))
        {
            if (room.CanMoveTo(player.GetX() + player.GetSpeedX(),
                               player.GetY(),
                               player.GetX() + player.GetWidth() + player.GetSpeedX(),
                               player.GetY() + player.GetHeight()))
            {
                player.MoveRight();
            }
        }
        if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT))
        {
            if (room.CanMoveTo(player.GetX() - player.GetSpeedX(),
                               player.GetY(),
                               player.GetX() + player.GetWidth() - player.GetSpeedX(),
                               player.GetY() + player.GetHeight()))
            {
                player.MoveLeft();
            }
        }
        if (SdlHardware.KeyPressed(SdlHardware.KEY_UP))
        {
            if (room.CanMoveTo(player.GetX(),
                               player.GetY() - player.GetSpeedY(),
                               player.GetX() + player.GetWidth(),
                               player.GetY() + player.GetHeight() - player.GetSpeedY()))
            {
                player.MoveUp();
            }
        }
        if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN))
        {
            if (room.CanMoveTo(player.GetX(),
                               player.GetY() + player.GetSpeedY(),
                               player.GetX() + player.GetWidth(),
                               player.GetY() + player.GetHeight() + player.GetSpeedY()))
            {
                player.MoveDown();
            }
        }

        if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC))
        {
            bombs.Add(new Bomb());
            bombs[bombs.Count - 1].MoveTo(player.GetX(), player.GetY());
            bombs[bombs.Count - 1].Show();
            bombs[bombs.Count - 1].Enable();
        }

        if (SdlHardware.KeyPressed(SdlHardware.KEY_H))
        {
            HelpScreen help = new HelpScreen();
            help.Run();
        }

        if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC))
        {
            finished = true;
        }
    }