Beispiel #1
0
        public override void think(GameTime gt)
        {
            base.think(gt);
            double currentTime = gt.TotalGameTime.TotalMilliseconds;

            if (!paperdeployed && (Ent.rand.NextDouble() < 0.003))
            {
                paperdeployed = true;
                Ent e = new EntPaperPlane();
                entities.add(e);
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Z) || (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed))
            {
                if (!specialFired && Epc.CanFire)
                {
                    specialFired = true;

                    for (double i = 0; i < 2 * Math.PI; i += Math.PI / 7)
                    {
                        for (double j = 0; j < 2 * Math.PI; j += Math.PI / 7)
                        {
                            // create bullet and fire it;
                            Quaternion r = Quaternion.CreateFromYawPitchRoll((float)Ent.rand.NextDouble() - 0.5f, (float)Ent.rand.NextDouble() - 0.5f, (float)Ent.rand.NextDouble() - 0.5f);
                            EntBullet Ebullet = new EntBullet(Epc, Quaternion.CreateFromYawPitchRoll((float)i, (float)j, 0) * r);
                            entities.add(Ebullet);
                        }

                    }
                }
            }
        }
Beispiel #2
0
        public override void think(GameTime gt)
        {
            base.think(gt);
            double currentTime = gt.TotalGameTime.TotalMilliseconds;

            if (!paperdeployed && (Ent.rand.NextDouble() < 0.003))
            {
                paperdeployed = true;
                Ent e = new EntPaperPlane();
                entities.add(e);
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Z) || (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed))
            {
                if (!specialFired && Epc.CanFire)
                {
                    specialFired = true;

                    for (double i = 0; i < 2 * Math.PI; i += Math.PI / 20)
                    {
                        // create bullet and fire it;
                        EntBullet Ebullet = new EntBullet(Epc, i);
                        entities.add(Ebullet);
                    }
                }
            }
        }
Beispiel #3
0
        public override void think(GameTime gt)
        {
            base.think(gt);
            foreach (Ent e in entities.Ents)
            {
                if (e is EntText)
                    entities.queueRemove(e);
            }
            entities.dequeAll();

            Epc.lives = float.PositiveInfinity;
            //hab1 = hab2 = hab3 = true;

            double currentTime = gt.TotalGameTime.TotalMilliseconds;

            if (Keyboard.GetState().IsKeyDown(Keys.Z) || (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed))
            {
                if ((currentTime - lastFired) > 200)
                {
                    lastFired = currentTime;

                    for (double i = 0; i < 2 * Math.PI; i += Math.PI / 7)
                    {
                        for (double j = 0; j < 2 * Math.PI; j += Math.PI / 7)
                        {
                            // create bullet and fire it;
                            Quaternion r = Quaternion.CreateFromYawPitchRoll((float)Ent.rand.NextDouble() - 0.5f, (float)Ent.rand.NextDouble() - 0.5f, (float)Ent.rand.NextDouble() - 0.5f);
                            EntBullet Ebullet = new EntBullet(Epc, Quaternion.CreateFromYawPitchRoll((float)i, (float)j, 0) * r);
                            entities.add(Ebullet);
                        }

                    }
                }

            }

            if (entities.Ents.Count < 100)
            {
                if (Ent.rand.NextDouble() < 0.01)
                {
                    double angle = Ent.rand.NextDouble() * Math.PI * 2;

                    EntBalloonSet Eballoonset = new EntBalloonSet(Vector3.One * -EntBalloonSet.defaultSprite.Width);
                    Eballoonset.velocity = new Vector3((float)Math.Cos(angle), (float)Math.Sin(angle), 0) * 0.1f;
                    entities.add(Eballoonset);
                }

                if (Ent.rand.NextDouble() < 0.01)
                {
                    EntAirBalloon e = new EntAirBalloon();
                    entities.add(e);
                }
            }

            /*
            if (Keyboard.GetState().IsKeyDown(Keys.P))
            {

                EntBalloon Eballoon = new EntBalloon();
                entities.add(Eballoon);

                Eballoon.position = Epc.position;
                Eballoon.velocity = Vector2.Zero;

            }

            if (Keyboard.GetState().IsKeyDown(Keys.O))
            {
                if ((currentTime - lastFired) > 200)
                {
                    lastFired = currentTime;

                    EntBalloonSet Eballoonset = new EntBalloonSet(Epc.position);
                    entities.add(Eballoonset);
                }
            }
            */
            if (Keyboard.GetState().IsKeyDown(Keys.H) || (GamePad.GetState(PlayerIndex.One).Buttons.X == ButtonState.Pressed))
            {
                if ((currentTime - lastFired) > 200)
                {
                    lastFired = currentTime;

                    EntAirBalloon e = new EntAirBalloon();
                    entities.add(e);

                }
            }

            if (Keyboard.GetState().IsKeyDown(Keys.G) || (GamePad.GetState(PlayerIndex.One).Buttons.Y == ButtonState.Pressed))
            {
                if ((currentTime - lastFired) > 200)
                {
                    lastFired = currentTime;
                    EntPaperPlane e = new EntPaperPlane();
                    entities.add(e);

                }
            }
        }