public void UpdatePlaying(GameTime currentTime) // Main gameplay
        {
            Ticks = Ticks + currentTime.ElapsedGameTime.TotalMilliseconds;

            // Invader movement
            if (Ticks > 500)
            {
                // Invader sideways movement
                for (int rows = 0; rows < 5; rows++)
                {
                    for (int cols = 0; cols < 11; cols++)
                    {
                        if (InvaderDir.Equals("Right"))
                        {
                            InvaderArray[rows, cols].X = InvaderArray[rows, cols].X + InvaderSpd;
                        }
                        if (InvaderDir.Equals("Left"))
                        {
                            InvaderArray[rows, cols].X = InvaderArray[rows, cols].X - InvaderSpd;
                        }
                    }
                }

                // Invader Limits
                string ChangeDir = "No";
                for (int rows = 0; rows < 5; rows++)
                {
                    for (int cols = 0; cols < 11; cols++)
                    {
                        if (InvaderLiving[rows, cols].Equals("Yes"))
                        {
                            if (InvaderArray[rows, cols].X + InvaderArray[rows, cols].Width > 870)
                            {
                                InvaderDir = "Left";
                                ChangeDir  = "Yes";
                            }

                            if (InvaderArray[rows, cols].X < 30)
                            {
                                InvaderDir = "Right";
                                ChangeDir  = "Yes";
                            }
                        }
                    }
                }

                // Invader downward movement
                if (ChangeDir.Equals("Yes"))
                {
                    for (int rows = 0; rows < 5; rows++)
                    {
                        for (int cols = 0; cols < 11; cols++)
                        {
                            InvaderArray[rows, cols].Y = InvaderArray[rows, cols].Y + 8;
                        }
                    }
                }


                Ticks = 0;
            }

            // Gunship control
            if (Keyboard.GetState().IsKeyDown(Keys.Right))
            {
                ShipXPos = ShipXPos + 3;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Left))
            {
                ShipXPos = ShipXPos - 3;
            }

            //Gunship limits
            if (ShipXPos < 15)
            {
                ShipXPos = 15;
            }

            if (ShipXPos > 780)
            {
                ShipXPos = 780;
            }

            // Firing missile
            if (ShotsFired != null) // Moves missile when it is visible
            {
                ShotsFired.Move();
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Space) & ShotsFired == null) // Fires missile when space is pressed
            {
                ShotsFired = new Missile(ShipXPos + 45, 565);
            }

            if (ShotsFired != null) // Deletes the missile when it passes the top of the screen
            {
                if (ShotsFired.GetMissilePos().Y < 0)
                {
                    ShotsFired = null;
                }
            }

            // Missile/invader collision detection
            if (ShotsFired != null)
            {
                MissileHitbox = new Rectangle((int)ShotsFired.GetMissilePos().X, (int)ShotsFired.GetMissilePos().Y,
                                              Missile.Width, Missile.Height);

                for (int rows = 0; rows < 5; rows++)
                {
                    for (int cols = 0; cols < 11; cols++)
                    {
                        if (InvaderLiving[rows, cols].Equals("Yes"))
                        {
                            if (MissileHitbox.Intersects(InvaderArray[rows, cols]))
                            {
                                ShotsFired = null;
                                InvaderLiving[rows, cols] = "No";
                                Score = Score + 50;
                            }
                        }
                    }
                }
            }

            // Gunship/Invader collision detection
            ShipHitbox = new Rectangle(ShipXPos, 565, Gunship.Width, Gunship.Height);

            for (int rows = 0; rows < 5; rows++)
            {
                for (int cols = 0; cols < 11; cols++)
                {
                    if (InvaderLiving[rows, cols].Equals("Yes"))
                    {
                        if (InvaderArray[rows, cols].Y + InvaderArray[rows, cols].Height > ShipHitbox.Y)
                        {
                            GameState = 3;
                        }
                    }
                }
            }

            // Speeds up invaders when they reach a certain point
            for (int rows = 0; rows < 5; rows++)
            {
                for (int cols = 0; cols < 11; cols++)
                {
                    if (InvaderLiving[rows, cols].Equals("Yes"))
                    {
                        if (InvaderArray[rows, cols].Y > 350)
                        {
                            InvaderSpd = 30;
                        }
                    }
                }
            }

            int Count = 0;

            for (int rows = 0; rows < 5; rows++)
            {
                for (int cols = 0; cols < 11; cols++)
                {
                    if (InvaderLiving[rows, cols].Equals("Yes"))
                    {
                        Count = Count + 1;
                    }
                }
            }

            // Finishes when all invaders killed
            if (Count == 0)
            {
                this.Exit();
            }
        }