Esempio n. 1
0
        public static bool UpSpace()
        {
            try
            {
                string Line = Maps.CurrentMap[Variables.YPlayer - 1];

                if (Variables.Finish.Contains(Line.Substring(Variables.XPlayer, 1)))
                {
                    Variables.Level++;

                    ReTitle.Counter();

                    SoundPlayer player = new SoundPlayer();
                    player.Stream = GameFolder.Misc.Music.finish;
                    player.Play();

                    Maps.EnumMap(true);
                }

                if (Line.Substring(Variables.XPlayer, 1) == "+")
                {
                    if (!ShiftVariable.ReSaveTitleThread)
                    {
                        ShiftVariable.ReSaveTitleThread = true;

                        new Thread(ReTitle.Save).Start();
                    }

                    Variables.XPlayerStart = Variables.XPlayer;
                    Variables.YPlayerStart = Variables.YPlayer;
                }
                else if (Variables.BackGroundDead.Contains(Line.Substring(Variables.XPlayer, 1)))
                {
                    Variables.Dead++;

                    ReTitle.Counter();

                    SoundPlayer player = new SoundPlayer();
                    player.Stream = GameFolder.Misc.Music.dead;
                    player.Play();

                    Maps.EnumMap(false);
                    return(true);
                }
                else if (Line.Substring(Variables.XPlayer, 1) == "=")
                {
                    Variables.YPlayer -= 2;
                    return(true);
                }
                else if (Variables.BackGround.Contains(Line.Substring(Variables.XPlayer, 1)))
                {
                    return(true);
                }
            }
            catch (System.ArgumentOutOfRangeException) { }
            catch (System.NullReferenceException) { }

            return(false);
        }
Esempio n. 2
0
        public static void Start()
        {
            do
            {
                Console.SetCursorPosition(Variables.XCursor, Variables.YCursor); // Set cursor position

                ConsoleKeyInfo PressedKey = Console.ReadKey();                   // Player press key

                SoundPlayer player = new SoundPlayer();

                switch (PressedKey.Key)
                {
                case ConsoleKey.LeftArrow:


                    player.Stream = GameFolder.Misc.Music.run;
                    player.Play();

                    Collision.Left();

                    break;

                case ConsoleKey.RightArrow:

                    player.Stream = GameFolder.Misc.Music.run;
                    player.Play();

                    Collision.Right();

                    break;

                case ConsoleKey.Spacebar:

                    if (!ShiftVariable.SpaceThread)
                    {
                        player.Stream = GameFolder.Misc.Music.smolJump;
                        player.Play();

                        SpacePlayer.Num = 0;
                        ThreadingSpace  = new Thread(SpacePlayer.Start);
                        ThreadingSpace.Start();
                    }

                    break;

                case ConsoleKey.UpArrow:

                    Collision.Up();

                    break;

                case ConsoleKey.DownArrow:

                    Collision.Down();

                    break;

                case ConsoleKey.F:

                    Variables.Dead = 0;

                    if (Maps.NumMap == 1)
                    {
                        Variables.XPlayerStart = Maps.Map0X;
                        Variables.YPlayerStart = Maps.Map0Y;
                    }
                    else if (Maps.NumMap == 2)
                    {
                        Variables.XPlayerStart = Maps.Map1X;
                        Variables.YPlayerStart = Maps.Map1Y;
                    }
                    else if (Maps.NumMap == 3)
                    {
                        Variables.XPlayerStart = Maps.Map2X;
                        Variables.YPlayerStart = Maps.Map2Y;
                    }
                    else if (Maps.NumMap == 4)
                    {
                        Variables.XPlayerStart = Maps.Map3X;
                        Variables.YPlayerStart = Maps.Map3Y;
                    }
                    else if (Maps.NumMap == 5)
                    {
                        Variables.XPlayerStart = Maps.Map4X;
                        Variables.YPlayerStart = Maps.Map4Y;
                    }
                    else if (Maps.NumMap == 6)
                    {
                        Variables.XPlayerStart = Maps.Map5X;
                        Variables.YPlayerStart = Maps.Map5Y;
                    }
                    Maps.EnumMap(false);

                    ReTitle.Counter();
                    break;

                case ConsoleKey.R:

                    Maps.EnumMap(false);
                    break;

                default:
                    ReDrawing.Draw();
                    break;
                }
            } while (true);
        }
Esempio n. 3
0
        public static void Right()
        {
            try
            {
                string Line  = Maps.CurrentMap[Variables.YPlayer];
                string Line0 = Maps.CurrentMap[Variables.YPlayer + 1];
                string Line1 = Maps.CurrentMap[Variables.YPlayer - 1];

                if (Variables.Finish.Contains(Line.Substring(Variables.XPlayer + 1, 1)) || Line1.Substring(Variables.XPlayer + 1, 1) == "-")
                {
                    Variables.Level++;

                    ReTitle.Counter();

                    SoundPlayer player = new SoundPlayer();
                    player.Stream = GameFolder.Misc.Music.finish;
                    player.Play();

                    Maps.EnumMap(true);
                }

                else if (Line0.Substring(Variables.XPlayer + 1, 1) == "+" || Line.Substring(Variables.XPlayer + 1, 1) == "+")
                {
                    if (!ShiftVariable.ReSaveTitleThread)
                    {
                        ShiftVariable.ReSaveTitleThread = true;

                        new Thread(ReTitle.Save).Start();
                    }

                    Variables.XPlayerStart = Variables.XPlayer + 1;
                    Variables.YPlayerStart = Variables.YPlayer;
                }
                if (Variables.BackGroundDead.Contains(Line.Substring(Variables.XPlayer + 1, 1)))
                {
                    Variables.Dead++;

                    ReTitle.Counter();

                    SoundPlayer player = new SoundPlayer();
                    player.Stream = GameFolder.Misc.Music.dead;
                    player.Play();

                    Maps.EnumMap(false);
                }
                else if (Line.Substring(Variables.XPlayer + 1, 1) == "*" && !Variables.BackGround.Contains(Line1.Substring(Variables.XPlayer + 1, 1)))
                {
                    Variables.XPlayer++;
                    Variables.YPlayer--;
                }
                else if (PressKeys.ShiftOperator(false) && !Variables.BackGround.Contains(Line.Substring(Variables.XPlayer + 1, 1)))
                {
                    Variables.XPlayer++;
                }

                if (!ShiftVariable.SpaceThread)
                {
                    new Thread(GameFolder.SpacePlayer.DownPlayer).Start();
                }
            }
            catch (System.ArgumentOutOfRangeException) { }
            catch (System.NullReferenceException) { }
        }