Example #1
0
        void TestBombCollision()
        {
            if (!TheDefender.Alive)
            {
                GameGoing = false;
                ending    = new Endings(500, 400, true, true);


                Invalidate();
            }

            if (TheDefender.BeenHit == true)
            {
                return;
            }

            if (InvaderCon.IsBombColliding(TheDefender.GetBounds()))
            {
                TheDefender.BeenHit = true;
            }
        }
Example #2
0
        private void timer2_Tick(object sender, System.EventArgs e)
        {
            HandleKeys();
            int count;

            TimerCounter++;

            if (GameGoing == false)
            {
                if (TimerCounter % 6 == 0)
                {
                    count = 6;
                }

                Invalidate();
                return;
            }


            if (TheBullet.Position.Y < 0)
            {
                ActiveBullet = false;
            }



            if (TimerCounter % TheSpeed == 0)
            {
                MoveInvaders();

                totalInvaders = TotalNumberOfInvaders();

                if (totalInvaders <= 20)
                {
                    TheSpeed = 5;
                }

                if (totalInvaders <= 10)
                {
                    TheSpeed = 4;
                }


                if (totalInvaders <= 5)
                {
                    TheSpeed = 3;
                }

                if (totalInvaders <= 3)
                {
                    TheSpeed = 2;
                }

                if (totalInvaders <= 1)
                {
                    TheSpeed = 1;
                }

                if (totalInvaders == 0)
                {
                    this.GameGoing = false;
                    ending         = new Endings(500, 400, false, true);
                }
            }

            TestBulletCollision();
            TestBombCollision();


            Invalidate();
        }