Beispiel #1
0
 protected void addRanger(int lower, int upper)
 {
     for (int i = 0; i < EventHandler.rand.Next(lower, upper); i++)
     {
         Color randomColorTint = Color.Lerp(Color.White, new Color(EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255)), 0.3f);
         //Ranger r = new Ranger(new NSprite(new Rectangle(EventHandler.rand.Next(100, 1280 - 230), EventHandler.rand.Next(100, 720 - 230), 50, 50), new Color(EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255))), 80, 3, 80, GObject.CollisionNature.KnockBack, new Gun(7, 20, 600));
         Ranger r = new Ranger(new TSprite(SpriteLoader.images["ranger"][0], new Rectangle(EventHandler.rand.Next(100, 1280 - 230), EventHandler.rand.Next(100, 720 - 230), 50, 50), randomColorTint), 80, 3, 80, GObject.CollisionNature.KnockBack, new Gun(7, 20, 600));
         _go.Add(r);
     }
 }
Beispiel #2
0
        public void EntityMoveHandle(GameTime gt)
        {
            //Random movement for Entities
            List <GObject> _go = _currRoom.getGObjects();

            foreach (GObject go in _go)
            {
                if (go is Ranger)
                {
                    Ranger r = (Ranger)go;
                    r.player = _currmap.player;
                    r.update(gt);
                }
                else if (go is Charger)
                {
                    Charger c = (Charger)go;
                    c.player = _currmap.player;
                    c.update(gt);
                }
            }
        }
Beispiel #3
0
        protected void addRandomEnemies()
        {
            for (int i = 0; i < EventHandler.rand.Next(2, 4); i++)
            {
                _go.Add(new GObject(new NSprite(new Rectangle(EventHandler.rand.Next(100, 1280 - 230), EventHandler.rand.Next(100, 720 - 230), 70, 70), new Color(EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255)))));
            }
            for (int i = 0; i < EventHandler.rand.Next(2, 4); i++)
            {
                _go.Add(new GObject(new NSprite(new Rectangle(EventHandler.rand.Next(100, 1280 - 230), EventHandler.rand.Next(100, 720 - 230), 30, 30), new Color(EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255))), GObject.CollisionNature.Free));
            }
            for (int i = 0; i < EventHandler.rand.Next(1, 4); i++)
            {
                Ranger r = new Ranger(new NSprite(new Rectangle(EventHandler.rand.Next(100, 1280 - 230), EventHandler.rand.Next(100, 720 - 230), 50, 50), new Color(EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255))), 80, 2, 80, GObject.CollisionNature.KnockBack, new Gun(6, 20, 600));

                _go.Add(r);
            }
            for (int i = 0; i < EventHandler.rand.Next(1, 4); i++)
            {
                Charger c = new Charger(new NSprite(new Rectangle(EventHandler.rand.Next(100, 1280 - 230), EventHandler.rand.Next(100, 720 - 230), 50, 50), new Color(EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255), EventHandler.rand.Next(0, 255))), 120, 8, 130, GObject.CollisionNature.KnockBack);
                _go.Add(c);
            }
        }