Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Rock Paper Scissors!");

            Console.Write("\nEnter your name: ");
            string name    = Console.ReadLine();
            bool   playing = true;

            while (playing)
            {
                Console.Write("would you like to play against Gozilla or Kong? (g/k)?: ");
                string play = Console.ReadLine();
                if (play == "g")
                {
                    MechaGodzilla mecha = new MechaGodzilla();
                    Roshambo      mchoice;
                    mchoice = mecha.GenerateRoshambo();
                    Godzilla god = new Godzilla();
                    Roshambo gchoice;
                    gchoice = god.GenerateRoshambo();
                    //Console.WriteLine(Play(mecha, god));
                    Console.WriteLine($"{Play(mecha, god)} is the winner");
                    Console.Write("play again? (y/n): ");
                    string end = Console.ReadLine();
                    if (end == "y")
                    {
                    }
                    else
                    {
                        playing = false;
                    }
                }
                else if (play == "k")
                {
                    MechaGodzilla mecha = new MechaGodzilla();
                    Roshambo      mchoice;
                    mchoice = mecha.GenerateRoshambo();
                    Kong     king = new Kong();
                    Roshambo kchoice;
                    kchoice = king.GenerateRoshambo();
                    Console.WriteLine($"{Play(mecha, king)} is the winner");
                    Console.Write("play again? (y/n): ");
                    string end = Console.ReadLine();
                    if (end == "y")
                    {
                    }
                    else
                    {
                        playing = false;
                    }
                }
                else
                {
                    Console.WriteLine("that is not a valid choice.");
                }
            }
        }
Beispiel #2
0
 static Winner Play(MechaGodzilla left, Kong right)
 {
     if (left.Choice == right.Choice)
     {
         return(Winner.draw);
     }
     if (left.Choice == Roshambo.Rock && right.Choice == Roshambo.Paper)
     {
         return(Winner.right);
     }
     else
     {
         return(Winner.left);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Ininializes all the necessary variables before the game starts
        /// </summary>
        public void Initialize()
        {
            ground = new Dictionary <string, List <Brick> >();

            allLadders = new List <Ladder>();
            allLives   = new List <GenericSprite>();

            brick.Initialize(new Vector2(_graphicsDevice.Viewport.Width * 0f, _graphicsDevice.Viewport.Height - brick._texture.Height));
            lineOfBricks       = new List <Brick>();
            allBarrels         = new List <Barrel>();
            toBeRemovedBarrels = new List <Barrel>();
            GroundLayoutSpawn();
            LadderSpawn();

            _mario = new Mario(_game, animationsMovementMario, marioSoundEffects, _graphicsDevice, true)
            {
                Position = new Vector2(_graphicsDevice.Viewport.Width * 0.1f, _graphicsDevice.Viewport.Height * 0.95f),
                Input    = new Input()
                {
                    Up     = Keys.W,
                    Down   = Keys.S,
                    Left   = Keys.A,
                    Right  = Keys.D,
                    Action = new List <Keys>()
                    {
                        Keys.Space, Keys.F, Keys.G, Keys.H, Keys.V, Keys.B, Keys.N
                    }
                },
                Speed = new Vector2(2f, 1.5f),
            };

            stackedBarrels._position = new Vector2(_graphicsDevice.Viewport.Width * 0f + 1, ground["Level5"][0]._position.Y - stackedBarrels._texture.Height);

            LivesLeftDisplay();

            _kong          = new Kong(_game, animationsKong, kongSoundEffects);
            _kong.Position = new Vector2(stackedBarrels._texture.Width + (stackedBarrels._texture.Width / 10), ground["Level5"][0]._position.Y - _kong._height);

            _princess          = new AnimatedSprite(_game, princessAnimations);
            _princess.Position = new Vector2(ground["Level6"][0]._position.X, ground["Level6"][0]._position.Y - _princess._height);

            oilBarrel          = new AnimatedSprite(_game, oilBarrelAnimations);
            oilBarrel.Position = new Vector2(_graphicsDevice.Viewport.Width * 0.01f, brick._position.Y - oilBarrel._height);
        }
Beispiel #4
0
 internal static bool IsKeyPressed(string itemName)
 {
     return(Kong.Item(itemName).GetValue <KeyBind>().Active);
 }
Beispiel #5
0
 internal static bool IsChecked(string itemName)
 {
     return(Kong.Item(itemName).GetValue <bool>());
 }
Beispiel #6
0
 internal static int GetStringListValue(string itemName)
 {
     return(Kong.Item(itemName).GetValue <StringList>().SelectedIndex);
 }
Beispiel #7
0
 internal static int GetSliderValue(string itemName)
 {
     return(Kong.Item(itemName).GetValue <Slider>().Value);
 }