Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            Fire();
            jet.Update(gameTime, recLeftSide, recRightSide, recB2, recB3, recB4, recB5);
            ship.Update(gameTime, recLeftSide, recRightSide, recB2, recB3, recB4, recB5);
            heli.Update(gameTime, recLeftSide, recRightSide, recB2, recB3, recB4, recB5);
            raider.Update(gameTime);

            if (fired)
            {
                recShot.Y -= 10;
                if (recShot.Y < -3)
                {
                    recShot = new Rectangle(raider.rectanglePos.X + raider.rectanglePos.Width / 2, raider.rectanglePos.Y + 5, 5, 25);
                    fired   = false;
                }
                if (recShot.Intersects(heli.rectanglePos))
                {
                    heli.position.Y = 0;
                    recShot         = new Rectangle(raider.rectanglePos.X + raider.rectanglePos.Width / 2, raider.rectanglePos.Y + 5, 5, 25);
                    score          += 2;
                    fired           = false;
                }
                if (recShot.Intersects(jet.rectanglePos))
                {
                    jet.position.Y = 0;
                    recShot        = new Rectangle(raider.rectanglePos.X + raider.rectanglePos.Width / 2, raider.rectanglePos.Y + 5, 5, 25);
                    score         += 3;
                    fired          = false;
                }
                if (recShot.Intersects(ship.rectanglePos))
                {
                    ship.position.Y = 0;
                    recShot         = new Rectangle(raider.rectanglePos.X + raider.rectanglePos.Width / 2, raider.rectanglePos.Y + 5, 5, 25);
                    score          += 1;
                    fired           = false;
                }
            }
            else
            {
                recShot = new Rectangle(raider.rectanglePos.X + raider.rectanglePos.Width / 2, raider.rectanglePos.Y + 5, 5, 25);  //pod raiderem
            }

            ElementsColision();
            EnemiesLoop();
            Background1Move();
            Background2Move();
            base.Update(gameTime);
        }