Exemple #1
0
 /*public override void draw(SpriteBatch sb)
 {
 }*/
 public void disperse(EntPC source)
 {
     foreach (EntBalloon e in balloons)
     {
         e.set = null;
         e.position += position;
         e.velocity = (e.position - position) + velocity;
         e.velocity.Normalize();
         resistance = 0.95f;
     }
     manager.queueRemove(this);
     source.score += 1;
 }
Exemple #2
0
        public EntBullet(EntPC o, double angle)
        {
            sprite = defaultSprite;
            wrapX = true;
            wrapY = true;
            used = false;

            owner = o;

            position = owner.position;
            double rangle = angle + rand.NextDouble() / 10;

            velocity = new Vector2((float)Math.Cos(rangle), (float)Math.Sin(rangle)) * 5;
            velocity += owner.velocity;
            resistance = 1;
        }
Exemple #3
0
        public override void join()
        {
            base.join();
            position = new Vector2(1 - size, ((float)rand.NextDouble() * (2.0f / 3.0f) + (1.0f / 6.0f)) * (manager.gameHeight));
            velocity = Vector2.Zero;
            resistance = 0.707f;

            List<Ent> ents = manager.Ents;
            foreach (Ent e in ents)
            {
                if (e is EntPC)
                {
                    target = (EntPC)e;
                    break;
                }
            }
        }
Exemple #4
0
        public override void join()
        {
            base.join();
            position = new Vector3(-30, ((float)rand.NextDouble() - 0.5f) * 8f + 20f, ((float)rand.NextDouble() - 0.5f) * 32f);
            velocity = Vector3.Zero;
            resistance = 0.707f;

            List<Ent> ents = manager.Ents;
            foreach (Ent e in ents)
            {
                if (e is EntPC)
                {
                    target = (EntPC)e;
                    break;
                }
            }
        }
Exemple #5
0
        public EntBullet(EntPC o, Quaternion q)
        {
            model = defaultModel;
            size = model.Meshes[0].BoundingSphere.Radius;

            wrapX = false;
            wrapY = false;
            used = false;

            owner = o;

            position = owner.position;
            orientation = q;

            Quaternion r = Quaternion.CreateFromYawPitchRoll((float)rand.NextDouble() / 20 - 1 / 40f, (float)rand.NextDouble() / 20 - 1 / 40f, (float)rand.NextDouble() / 20 - 1 / 40f);

            velocity = Vector3.Transform(Vector3.UnitZ * -2f, orientation * r);
            velocity += owner.velocity;
            resistance = 1;

            mycolor = new Vector3(0.8f, 0.3f, 0);

            size *= 2;
        }
Exemple #6
0
        public void init(Game g, Vector2 v)
        {
            caller = g;
            windowSize = v;

            entities = new EntManager();
            entities.gameWidth = ((int)windowSize.X);
            entities.gameHeight = ((int)windowSize.Y);

            Epc = new EntPC();
            Epc.position = Vector3.Zero;
            Epc.resistance = 0.8f;
            Epc.font = EntPC.defaultFont;
            entities.add(Epc);

            int numsets = 5;
            for (int i = 0; i < numsets; ++i)
            {
                Vector3 p = new Vector3((float)Math.Cos(Math.PI * 2 * i / numsets), (float)Math.Sin(Math.PI * 2 * i / numsets), (float)(Ent.rand.NextDouble() * 2.0 - 1.0));
                EntBalloonSet e = new EntBalloonSet(p * 8);
                e.velocity = p * 0.1f;
                entities.add(e);
            }

            startballoons = 0;
            foreach (Ent e in entities.Ents)
            {
                if (e is EntBalloon) startballoons++;
            }
        }
Exemple #7
0
 public void pop(EntPC source)
 {
     manager.queueRemove(this);
     if (source != null)
         source.score += 2;
 }
Exemple #8
0
        public void init(Game g, Vector2 v)
        {
            caller = g;
            windowSize = v;

            entities = new EntManager();
            entities.gameWidth = ((int)windowSize.X);
            entities.gameHeight = ((int)windowSize.Y);

            Epc = new EntPC();
            Epc.position = windowSize / 2;
            Epc.resistance = 0.8f;
            Epc.font = EntPC.defaultFont;
            entities.add(Epc);

            int numsets = 7;
            for (int i = 0; i < numsets; ++i)
            {
                Vector2 p = new Vector2((float)Math.Cos(Math.PI * 2 * i / numsets), (float)Math.Sin(Math.PI * 2 * i / numsets));
                EntBalloonSet e = new EntBalloonSet(p * 256 + windowSize / 2);
                e.velocity = new Vector2(p.Y, -p.X) * 4;
                entities.add(e);
            }

            startballoons = 0;
            foreach (Ent e in entities.Ents)
            {
                if (e is EntBalloon) startballoons++;
            }

            clouds = new List<Vector2>();

            for (int i = 0; i < 20; ++i) {
                clouds.Add(new Vector2((float)Ent.rand.NextDouble(), (float)Ent.rand.NextDouble()) * (windowSize - new Vector2(cloud.Width, cloud.Height)));
            }
        }