Example #1
0
 public void FrogUpTwoStep(int startCol, int startRow)
 {
     this.PrintFrog(this.Coll, this.Row - 2);
     Console.SetCursorPosition(this.Coll, this.Row);
     Console.Write("    ");
     Console.SetCursorPosition(this.Coll, this.Row + 1);
     Console.Write("    ");
     Sounds.JumpSound();
 }
Example #2
0
        public void Move()
        {
            this.PrintFrog(this.Coll, this.Row);

            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo userInput = Console.ReadKey(true);
                while (Console.KeyAvailable)
                {
                    Console.ReadKey(true);
                }

                if (userInput.Key == ConsoleKey.RightArrow)
                {
                    if (this.Coll < MainProgram.MaxWidth - 4)
                    {
                        this.PrintFrog(this.Coll + 1, this.Row);
                        Console.SetCursorPosition(this.Coll, this.Row);
                        Console.Write(" ");
                        Console.SetCursorPosition(this.Coll, this.Row + 1);
                        Console.Write(" ");
                        Sounds.JumpSound();
                        this.Coll++;
                    }
                }

                if (userInput.Key == ConsoleKey.LeftArrow)
                {
                    if (this.Coll > 0)
                    {
                        this.PrintFrog(this.Coll - 1, this.Row);
                        Console.SetCursorPosition(this.Coll + 2, this.Row);
                        Console.Write(" ");
                        Console.SetCursorPosition(this.Coll + 3, this.Row + 1);
                        Console.Write(" ");
                        Sounds.JumpSound();
                        this.Coll--;
                    }
                }

                if (userInput.Key == ConsoleKey.UpArrow)
                {
                    if (this.Row > 11)
                    {
                        this.PrintFrog(this.Coll, this.Row - 1);
                        for (int i = 0; i <= 3; i++)
                        {
                            Console.SetCursorPosition(this.Coll + i, this.Row + 1);
                            Console.Write(" ");
                        }
                        Sounds.JumpSound();
                        this.Row--;
                    }
                    else if (this.Row == 11 && this.Coll == 10)
                    {
                        FrogUpTwoStep(this.Coll, this.Row);
                        this.PrintFrog(10, 9);
                        this.Coll = 48;
                        this.Row  = 48;
                        this.PrintFrog(this.Coll, this.Row);
                        this.inHome++;
                    }
                    else if (this.Row == 11 && this.Coll == 24)
                    {
                        FrogUpTwoStep(this.Coll, this.Row);
                        this.PrintFrog(24, 9);
                        this.Coll = 48;
                        this.Row  = 48;
                        this.PrintFrog(this.Coll, this.Row);
                        this.inHome++;
                    }
                    else if (this.Row == 11 && this.Coll == 38)
                    {
                        FrogUpTwoStep(this.Coll, this.Row);
                        this.PrintFrog(38, 9);
                        this.Coll = 48;
                        this.Row  = 48;
                        this.PrintFrog(this.Coll, this.Row);
                        this.inHome++;
                    }
                    else if (this.Row == 11 && this.Coll == 52)
                    {
                        FrogUpTwoStep(this.Coll, this.Row);
                        this.PrintFrog(52, 9);
                        this.Coll = 48;
                        this.Row  = 48;
                        this.PrintFrog(this.Coll, this.Row);
                        this.inHome++;
                    }
                    else if (this.Row == 11 && this.Coll == 66)
                    {
                        FrogUpTwoStep(this.Coll, this.Row);
                        this.PrintFrog(66, 9);
                        this.Coll = 48;
                        this.Row  = 48;
                        this.PrintFrog(this.Coll, this.Row);
                        this.inHome++;
                    }
                }

                if (userInput.Key == ConsoleKey.DownArrow)
                {
                    if (this.Row < MainProgram.MaxHeight - 2)
                    {
                        this.PrintFrog(this.Coll, this.Row + 1);
                        Console.SetCursorPosition(this.Coll + 1, this.Row);
                        Console.Write(" ");
                        Console.SetCursorPosition(this.Coll + 2, this.Row);
                        Console.Write(" ");
                        Sounds.JumpSound();
                        this.Row++;
                    }
                }
            }
        }