Пример #1
0
        public override void Update()
        {
            if (FrameCount == 0)
            {
                foreach (MobileEntity mob in Mobs)
                {
                    mob.Position = new Vector2(Constants.D, -30 * (Mobs.IndexOf(mob) + 1));
                    mob.Active   = true;
                }
            }

            foreach (MobileEntity mob in Mobs)
            {
                if (mob.Position.Y < Constants.G)
                {
                    mob.UpdatePosition("down");
                }
                else
                {
                    mob.UpdatePosition("right");
                }
                if (mob.Position.X > Constants.PLAYABLE_WIDTH)
                {
                    mob.Active = false;
                }
            }
            foreach (MoveScript formation in Bullets)
            {
                formation.Update();
            }
            FrameCount++;
        }
Пример #2
0
 public ZigRight(List <MobileEntity> mobs, bool willFire) : base(mobs, willFire)
 {
     FrameCount = 0;
     foreach (MobileEntity mob in Mobs)
     {
         mob.Position = new Vector2((0 - 60 * Mobs.IndexOf(mob)), Constants.E);
         mob.Active   = true;
     }
 }
Пример #3
0
        public override void Update()
        {
            //string pattern = "Arrowhead";
            //string trajectory = "Arc";
            //int numBullets = 10;
            //string bulletType = "BulletTypeA";
            int initialXPosition = Constants.K - (30 * ((Mobs.Count / 2) - 1));

            if (FrameCount == 0)
            {
                foreach (MobileEntity mob in Mobs)
                {
                    mob.Position = new Vector2((initialXPosition + 30 * Mobs.IndexOf(mob)), -30 * (Mobs.IndexOf(mob) + 1));
                    mob.Active   = true;
                }
            }
            foreach (MobileEntity mob in Mobs)
            {
                //mobs enter from top of screen for 5 seconds
                if (FrameCount < 5 * Constants.FPS)
                {
                    if (mob.Position.Y < Constants.F)
                    {
                        mob.UpdatePosition("down");
                    }
                    else if (mob.Position.Y < Constants.F + mob.MoveSpeed)
                    {
                        //fire(pattern, mob, bulletType, mob.Color, numBullets, trajectory);
                        if (this.willFire && mob.Active)
                        {
                            //List<MobileEntity>bullets = formation.SetFormation("BulletTypeA", mob.Position);
                            Formation formation = new Arrowhead(bulletMaker, mob.Position);
                            //List<MobileEntity> bulletFormation = BulletMaker.CreateBulletList("BulletTypeA", new Arrowhead(mob.Position));
                            Bullets.Add(MoveScriptMaker.CreateMoveScript("Arc", formation.SetFormation("BulletTypeA"), false));
                        }
                        mob.UpdatePosition("down");
                    }
                }
                else //mobs begin exiting one by one
                {
                    if (FrameCount > (5 + Mobs.IndexOf(mob)) * Constants.FPS)
                    {
                        mob.UpdatePosition("up");
                    }
                    if (mob.Position.Y < 0)
                    {
                        mob.Active = false;
                    }
                }
            }
            foreach (MoveScript formation in Bullets)
            {
                formation.Update();
            }
            FrameCount++;
        }
Пример #4
0
 public override void Update()
 {
     if (FrameCount == 0)
     {
         foreach (MobileEntity mob in Mobs)
         {
             mob.Position = new Vector2((660 + 60 * Mobs.IndexOf(mob)), Constants.E);
             mob.Active   = false;
         }
     }
     foreach (MobileEntity mob in Mobs)
     {
         if (mob.Position.X < Constants.PLAYABLE_WIDTH && mob.Position.X > 0)
         {
             mob.Active = true;
         }
         //mobs enter from Left at E, then move upLeft between 0-C, G-K, O-S
         if (mob.Position.X >= 0 && mob.Position.X < Constants.C || mob.Position.X >= Constants.G && mob.Position.X < Constants.K || mob.Position.X >= Constants.O && mob.Position.X < Constants.S)
         {
             mob.UpdatePosition("upLeft");
         }
         //the mobs move downLeft between C-G, K-O, S-V
         else if (mob.Position.X >= Constants.C && mob.Position.X < Constants.G || mob.Position.X >= Constants.K && mob.Position.X < Constants.O || mob.Position.X >= Constants.S && mob.Position.X < Constants.V)
         {
             mob.UpdatePosition("downLeft");
         }
         // just go left if off the either side of the screen
         else
         {
             mob.UpdatePosition("left");
             if (mob.Position.X <= 0)
             {
                 mob.Active = false;
             }
         }
         foreach (MoveScript formation in Bullets)
         {
             formation.Update();
         }
         FrameCount++;
     }
 }
Пример #5
0
        public override void Update()
        {
            if (FrameCount == 0)
            {
                foreach (MobileEntity mob in Mobs)
                {
                    mob.Position = new Vector2((0 - 60 * Mobs.IndexOf(mob)), Constants.E);
                    mob.Active   = true;
                }
            }
            // x and y are seporate so that the framecount mod can be changed seporately for more fine control
            foreach (MobileEntity mob in Mobs)
            {
                if (FrameCount % 1 == 0)
                {
                    mob.UpdatePosition("right");
                }

                if (FrameCount % 1 == 0)
                {
                    mob.Position = new Vector2(mob.Position.X, Constants.E + (-(float)Math.Cos(mob.Position.X / 50) * 150));
                }
                if (mob.Position.X > Constants.PLAYABLE_WIDTH)
                {
                    mob.Active = false;
                }
                foreach (MoveScript formation in Bullets)
                {
                    formation.Update();
                }
                FrameCount++;
            }
            foreach (MoveScript formation in Bullets)
            {
                formation.Update();
            }
            FrameCount++;
        }
Пример #6
0
        public override void Update()
        {
            int    firingInterval    = 2;
            int    mobFiringInterval = 2;
            string bulletType        = "BulletTypeA";

            if (FrameCount == 0)
            {
                foreach (MobileEntity mob in Mobs)
                {
                    mob.Position = new Vector2((-30 - 60 * Mobs.IndexOf(mob)), (-30 - 60 * Mobs.IndexOf(mob)));
                    mob.Active   = true;
                }
            }

            foreach (MobileEntity mob in Mobs)
            {
                if (FrameCount % (firingInterval * Constants.FPS) == 0)
                {
                    if (Mobs.IndexOf(mob) % mobFiringInterval == 0)
                    {
                        Solo formation = new Solo(new BulletMaker(), mob.Position);
                        Bullets.Add(MoveScriptMaker.CreateMoveScript(default, formation.SetFormation(bulletType), false));