Example #1
0
        public void Paint()
        {
            level.Paint();
            player.Paint();

            GuiUpdater.SetLevel(level.Name);
            GuiUpdater.SetPoints(Points);
            GuiUpdater.SetLives(Lives);
            GuiUpdater.ShowTopStrip();
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.Title         = GameSettings.Title;
            Console.CursorVisible = false;

            GuiUpdater.ShowCompanyNameScreen();
            GuiUpdater.ShowTitleScreen();

            MainMenuScreen menu = new MainMenuScreen();

            menu.Show();
        }
Example #3
0
        private int StartPlaying()
        {
            ConsoleKeyInfo keyInfo;

            while (true)
            {
                while (Console.KeyAvailable)
                {
                    keyInfo = Console.ReadKey(true);
                    switch (keyInfo.Key)
                    {
                    case ConsoleKey.UpArrow:
                        player.Move(new Point(0, -1), level, Time);
                        break;

                    case ConsoleKey.DownArrow:
                        player.Move(new Point(0, 1), level, Time);
                        break;

                    case ConsoleKey.LeftArrow:
                        player.Move(new Point(-1, 0), level, Time);
                        break;

                    case ConsoleKey.RightArrow:
                        player.Move(new Point(1, 0), level, Time);
                        break;

                    case ConsoleKey.Escape:
                        return(CODE_PAUSE);

                    default:
                        break;
                    }
                }

                level.MoveEnemies(Time);

                if (level.CheckCoinCollision(player.Pos))
                {
                    Points++;
                    GuiUpdater.SetPoints(Points);
                }

                if (level.CheckEnemyCollision(player.Pos))
                {
                    Lives--;
                    Time = 0;

                    if (Lives < 1)
                    {
                        return(CODE_LOST);
                    }

                    player.MoveToPosition(level.Spawn, level);
                    GuiUpdater.SetLevel(level.Name);
                    GuiUpdater.SetLives(Lives);
                    GuiUpdater.SetPoints(Points);
                    GuiUpdater.ShowTopStrip();

                    continue;
                }

                if (level.CheckFinishCollision(player.Pos))
                {
                    return(CODE_WON);
                }

                Time++;
                Thread.Sleep(16);
            }
        }