Beispiel #1
0
        public void MakeFireFlash(Vector2 loc, Vector2 traj, bool smoke)
        {
            for (int i = 0; i < 16; i++)
            {
                AddParticle(new MuzzleFlash(loc + (traj * (float)i) * 0.0001f + RandomMachine.GetRandomVector2(-5f, 5f, -5f, 5f),
                                            traj / 5f,
                                            (20f - (float)i) * 0.06f,
                                            Color.PaleGoldenrod));

                AddParticle(new MuzzleFlash(loc + (traj * (float)i) * 0.0001f + RandomMachine.GetRandomVector2(-1f, 1f, -1f, 1f),
                                            traj / 5f,
                                            (5f - (float)i) * 0.06f,
                                            Color.Orange));
            }

            if (smoke)
            {
                for (int i = 0; i < 4; i++)
                {
                    AddParticle(new Smoke(loc, RandomMachine.GetRandomVector2(-10f, 10f, -10f, 0f),
                                          0f, 0f, 0f, 0.25f,
                                          RandomMachine.GetRandomFloat(0.25f, 1.0f),
                                          RandomMachine.GetRandomInt(0, 4)));
                }
            }
        }
            public SnowballLauncherShot(Vector2 loc, Weapon wpn, double angle, SpriteEffects _flip) :
                base(loc,
                     Rectangle.Empty,       //Sprite
                     new Vector2(250, 250), //Speed
                     Vector2.One,           //Scale
                     _flip, wpn, angle, true)
            {
                this.visualRotation = 0f;
                this.UseSpriteOrigin();

                if (RandomMachine.GetRandomFloat(0, 1) > 0.59f)
                {
                    this.sRect = new Rectangle(768, 895, 107, 105);
                }
                else
                {
                    this.sRect = new Rectangle(893, 891, 124, 116);
                }


                float newScale = RandomMachine.GetRandomFloat(0.3f, 1.2f);

                this.Scale = new Vector2(newScale, newScale);

                int newSpeed = RandomMachine.GetRandomInt(250, 450);

                this.speed = new Vector2(newSpeed, newSpeed);

                this.hitbox = new CircleHitbox(this, true, 2f);

                this.Destructable = true;
                this.Points       = 250;
                this.Hp           = 15;
            }
Beispiel #3
0
        /// <summary>
        /// Create customizable explosion
        /// </summary>
        /// <param name="loc"></param>
        /// <param name="mag"></param>
        public void MakeCircularExplosion(Vector2 loc, float size, int precision)
        {
            for (int i = 0; i < precision; i++)
            {
                if (TGPAContext.Instance.Cheatcodes.IsKawaii)
                {
                    AddParticle(new HeartWave(loc, RandomMachine.GetRandomVector2(loc, size),
                                              RandomMachine.GetRandomFloat(1f, 1.5f),
                                              RandomMachine.GetRandomInt(0, 4)));
                }
                else
                {
                    AddParticle(new Smoke(loc, RandomMachine.GetRandomVector2(loc, size),
                                          0.40f, .40f, .40f, 1f,
                                          RandomMachine.GetRandomFloat(1f, 1.5f),
                                          RandomMachine.GetRandomInt(0, 4)));
                }
            }

            for (int i = 0; i < precision; i++)
            {
                AddParticle(new Fire(loc, RandomMachine.GetRandomVector2(-(size - 20), size - 20, -(size - 20), size),
                                     1f, RandomMachine.GetRandomInt(0, 4)));
            }
        }
Beispiel #4
0
        /// <summary>
        /// Create explosion
        /// </summary>
        /// <param name="loc"></param>
        /// <param name="mag"></param>
        public void MakeExplosionWithoutQuake(Vector2 loc)
        {
            for (int i = 0; i < 4; i++)
            {
                if (TGPAContext.Instance.Cheatcodes.IsKawaii)
                {
                    AddParticle(new HeartWave(loc, RandomMachine.GetRandomVector2(-100f, 100f, -100f, 100f),
                                              RandomMachine.GetRandomFloat(1f, 1.5f),
                                              RandomMachine.GetRandomInt(0, 4)));
                }
                else
                {
                    AddParticle(new Smoke(loc, RandomMachine.GetRandomVector2(-100f, 100f, -100f, 100f),
                                          0.40f, .40f, .40f, 1f,
                                          RandomMachine.GetRandomFloat(1f, 1.5f),
                                          RandomMachine.GetRandomInt(0, 4)));
                }
            }

            for (int i = 0; i < 4; i++)
            {
                AddParticle(new Fire(loc, RandomMachine.GetRandomVector2(-80f, 80f, -80f, 80f),
                                     1f, RandomMachine.GetRandomInt(0, 4)));
            }

            //AddParticle(new Shockwave(loc, true, 25f));
            //AddParticle(new Shockwave(loc, false, 10f))
        }
Beispiel #5
0
        /// <summary>
        /// Create explosion with blast
        /// </summary>
        /// <param name="loc"></param>
        /// <param name="mag"></param>
        public void MakeExplosion(Vector2 loc, float size)
        {
            for (int i = 0; i < 8; i++)
            {
                if (TGPAContext.Instance.Cheatcodes.IsKawaii)
                {
                    AddParticle(new HeartWave(loc, RandomMachine.GetRandomVector2(-100f, 100f, -100f, 100f),
                                              RandomMachine.GetRandomFloat(size / 2, size * 2),
                                              RandomMachine.GetRandomInt(0, 4)));
                }
                else
                {
                    AddParticle(new Smoke(loc, RandomMachine.GetRandomVector2(-100f, 100f, -100f, 100f),
                                          0.40f, .40f, .40f, 1f,
                                          RandomMachine.GetRandomFloat(size / 2, size * 2),
                                          RandomMachine.GetRandomInt(0, 4)));
                }
            }

            for (int i = 0; i < 8; i++)
            {
                AddParticle(new Fire(loc, RandomMachine.GetRandomVector2(-80f, 80f, -80f, 80f),
                                     size, RandomMachine.GetRandomInt(0, 4)));
            }

            //AddParticle(new Shockwave(loc, true, 25f));
            //AddParticle(new Shockwave(loc, false, 10f));

            ////Shake screen
            //QuakeManager.SetQuake(.5f);
            //QuakeManager.SetBlast(1f, loc);
        }
            public override void TodoOnFiring(Vector2 location)
            {
                TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(location, RandomMachine.GetRandomVector2(-20f, 20f, 20f, 20f),
                                                                           0.8f, 0.8f, 0.8f, 1f, RandomMachine.GetRandomFloat(1.5f, 4.5f), RandomMachine.GetRandomInt(0, 4)), false);

                base.TodoOnFiring(location);
            }
Beispiel #7
0
 public override void TodoOnFiring(Vector2 location)
 {
     ((PingouinLauncher)owner).Firing = true;
     //Smoke and fire
     TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(location, RandomMachine.GetRandomVector2(-20f, 20f, 20f, 20f),
                                                                0.8f, 0.8f, 0.8f, 1f, RandomMachine.GetRandomFloat(1.5f, 4.5f), RandomMachine.GetRandomInt(0, 4)), false);
 }
        public override List <Shot> Fire(Vector2 location)
        {
            List <Shot> newTirs = new List <Shot>();

            newTirs.Add(new MaskedEsquimoGunShot(location, this, RandomMachine.GetRandomFloat(3 * Math.PI / 4, 5 * Math.PI / 4), this.Flip));
            return(newTirs);
        }
        public Rock(Vector2 loc, Vector2 scroll, Bonus bonus, MovePattern pattern, SpriteEffects flip, String[] flags) :
            base(loc, scroll, bonus, pattern, flags, flip,
                 Rectangle.Empty, //Source sprite
                 Vector2.Zero,    //Speed
                 Vector2.One,
                 null
                 )
        {
            //Stats
            hp     = 3;
            points = 1000;

            this.icon = RandomMachine.GetRandomInt(0, 3);
            if (this.icon == 3)
            {
                this.icon = 1;                 //HACK
            }
            sRect     = new Rectangle(0 + (128 * icon), 0, 128, 128);
            dRect     = ComputeDstRect(sRect);
            speedYBis = 0f;

            if (this.icon != 2)
            {
                visualRotation = 0f;
            }

            UseRotationWhenDrawing = true;
            UseSpriteOrigin();
            this.hitbox     = new CircleHitbox(this, true, 2f);
            this.Background = true;
        }
        public override void TodoOnDeath()
        {
            //Free a PoulpiSnow
            MovePattern mp = new MovePattern();

            switch (this.Flip)
            {
            case SpriteEffects.FlipHorizontally:
                mp.AddPoint((int)this.location.X, (int)TGPAContext.Instance.ScreenHeight / 2);
                mp.AddPoint((int)TGPAContext.Instance.ScreenWidth + 1, (int)TGPAContext.Instance.ScreenHeight / 2);
                break;

            case SpriteEffects.None:
                mp.AddPoint((int)this.location.X, (int)TGPAContext.Instance.ScreenHeight / 2);
                mp.AddPoint(-500, (int)TGPAContext.Instance.ScreenHeight / 2);
                break;
            }

            Snow s = new Snow(this.location, RandomMachine.GetRandomVector2(-100f, 20f, 50f, -300f), 800f, RandomMachine.GetRandomInt(0, 4));

            TGPAContext.Instance.ParticleManager.AddParticle(s, false);

            PoulpiSnow ps = new PoulpiSnow(this.location, this.scrollValue, null, mp, this.Flip, this.flagsOnDeath);

            TGPAContext.Instance.AddEnemy(ps);

            //base.TodoOnDeath();
        }
Beispiel #11
0
        /// <summary>
        /// Constructor
        /// </summary>
        protected Application(string name, string rootContentDirectory, string version)
        {
            // associates the static application instance to the current one
            Instance = this;

            _name    = name;
            _version = version;

#if WINDOWS
            Window.Title = _name;
#endif

            Content.RootDirectory = rootContentDirectory;

            _graphics = new GraphicsDeviceManager(this);

            _inputManager        = new InputManager();
            _magicContentManager = new MagicContentManager(GameAssemblies, Content);
            _gameStateManager    = new GameStateManager();
            _scriptManager       = new ScriptManager();
            _physicsManager      = new PhysicsManager();

            _fpsCounter    = new FpsCounter();
            _randomMachine = new RandomMachine(DateTime.Now.Millisecond);

            //Xbox Live
#if XBOX
            this.Components.Add(new GamerServicesComponent(this));
#endif
        }
        public override void Update(GameTime gameTime)
        {
            rotation += RandomMachine.GetRandomFloat(0.005f, 0.025f);
            base.Update(gameTime);

            TGPAContext.Instance.ParticleManager.MakeBullet(location, RandomMachine.GetRandomVector2(location, 2f), true);
        }
Beispiel #13
0
            public override void Update(GameTime gameTime)
            {
                TGPAContext.Instance.Player1.EnableCommands = false;

                if (TGPAContext.Instance.Player2 != null)
                {
                    TGPAContext.Instance.Player2.EnableCommands = false;
                }

                this.alphaFadeOut += 0.005f;

                if (this.cooldown <= 0f)
                {
                    this.cooldown = RandomMachine.GetRandomFloat(50f, 300f);

                    Vector2 loc = RandomMachine.GetRandomVector2(0, TGPAContext.Instance.ScreenWidth, 0, TGPAContext.Instance.ScreenHeight);

                    TGPAContext.Instance.ParticleManager.MakeCircularExplosion(loc, 150f, 200);
                }
                else
                {
                    this.cooldown -= (float)gameTime.ElapsedGameTime.TotalMilliseconds;
                }

                base.Update(gameTime);
            }
        public override List <Shot> Fire(Vector2 location)
        {
            List <Shot> newTirs = new List <Shot>();

            float   angle   = RandomMachine.GetRandomFloat(Math.PI / 2, Math.PI);
            Vector2 shotLoc = location;

            for (int i = 0; i < 16; i++)
            {
                newTirs.Add(new ElFeroCactaeWPNShot1(shotLoc, this, angle, this.Flip));

                if (i % 2 == 0)
                {
                    shotLoc.X += 30;
                }
                else
                {
                    shotLoc.Y += 30;
                }

                if (i % 5 == 0)
                {
                    angle += (float)Math.PI / 8;
                }
            }

            return(newTirs);
        }
Beispiel #15
0
        public override void Update(GameTime gameTime)
        {
            if (!targetFound)
            {
                Pattern = null;

                //Chasing the player : build a move pattern on him
                MovePattern mp = new MovePattern();

                int rand = RandomMachine.GetRandomInt(0, 1);

                Player p = TGPAContext.Instance.Player1;
                if ((rand == 0) && (TGPAContext.Instance.Player2 != null))
                {
                    p = TGPAContext.Instance.Player2;
                }

                mp.AddPoint(p.DstRect.Center);

                if (location.X > (int)p.Location.X)
                {
                    mp.AddPoint(new Point(-50, (int)p.Location.Y));
                }
                else
                {
                    mp.AddPoint(new Point(TGPAContext.Instance.ScreenWidth + 100, (int)p.Location.Y));
                }
                Pattern = mp;

                targetFound = true;
            }

            base.Update(gameTime);
        }
        public override List <Shot> Fire(Vector2 location)
        {
            List <Shot> newTirs = new List <Shot>();

            newTirs.Add(new StarFishShot(location, this, RandomMachine.GetRandomFloat(0.0f, 2 * Math.PI), this.Flip));

            return(newTirs);
        }
Beispiel #17
0
        public RandomCow(Vector2 loc, Vector2 scroll, Bonus bonus, MovePattern pattern, SpriteEffects flip, String[] flags)
            : base(loc, scroll, bonus, pattern, flip, flags)
        {
            //Randomize scale for fun
            float scale = RandomMachine.GetRandomFloat(0.35f, 1.3f);

            this.Scale = new Vector2(scale, scale);
        }
Beispiel #18
0
        public override List <Shot> Fire(Vector2 location)
        {
            List <Shot> newTirs = new List <Shot>();

            newTirs.Add(new FastNutsShot(location, this, RandomMachine.GetRandomFloat(0.0f, 32 * (Math.PI / 16)), this.Flip));

            return(newTirs);
        }
Beispiel #19
0
        public override List <Shot> Fire(Vector2 location)
        {
            List <Shot> newTirs = new List <Shot>();

            newTirs.Add(new MiniBNMachineGunShot(location, this, RandomMachine.GetRandomFloat((float)(15 * (Math.PI / 8)) * Direction, (float)(17 * (Math.PI / 8))), this.Flip));

            return(newTirs);
        }
        public override void TodoOnFiring(Vector2 location)
        {
            Vector2 gunLocation = new Vector2(location.X, location.Y);

            base.TodoOnFiring(gunLocation);

            TGPAContext.Instance.ParticleManager.MakeFireFlash(gunLocation, RandomMachine.GetRandomVector2(-4f, 4f, -4f, 4f), false);
        }
        public override List <Shot> Fire(Vector2 location)
        {
            List <Shot> newTirs = new List <Shot>();

            newTirs.Add(new ElFeroCactaeWPNShot2(location, this, RandomMachine.GetRandomFloat(0.0f, (float)(Math.PI)), this.Flip));

            return(newTirs);
        }
        /// <summary>
        /// Caca are stuck on the ground until player fly around them. Then the caca enable its powerfull jetpack to hit the player.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            if (!launching)
            {
                //Check if player is near the caca
                bool p1 = Math.Abs(TGPAContext.Instance.Player1.DstRect.Center.X - location.X) < 130;

                bool p2 = false;

                if (TGPAContext.Instance.Player2 != null)
                {
                    p2 = Math.Abs(TGPAContext.Instance.Player2.DstRect.Center.X - location.X) < 130;
                }

                if (p1 || p2)
                {
                    launching = true;

                    //Smile on caca's face
                    sRect.X = 128;

                    //Play a funny sound
                    SoundEngine.Instance.PlaySound("specialPlop");
                }
            }

            //Fly !
            if (launching)
            {
                speedBis    -= 5;
                this.speed.Y = speedBis;

                float tempsEcoule  = (float)gameTime.ElapsedGameTime.TotalSeconds;
                float deplacementY = (speed.Y * tempsEcoule);

                location.Y += deplacementY;

                Vector2 newLoc = Vectors.ConvertPointToVector2(DstRect.Center);

                //Little smoke contrail
                TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(newLoc, RandomMachine.GetRandomVector2(0f, 0f, 10f, 40f),
                                                                           0.30f, 0.30f, 0.30f, 1f,
                                                                           RandomMachine.GetRandomFloat(0.1f, .3f),
                                                                           RandomMachine.GetRandomInt(0, 4)), true);

                Fire f = new Fire(newLoc, RandomMachine.GetRandomVector2(0f, 0f, 10f, 40f),
                                  0.25f, RandomMachine.GetRandomInt(0, 4));
                TGPAContext.Instance.ParticleManager.AddParticle(f, true);
            }

            base.Update(gameTime);

            if (launching)
            {
                this.speed.Y = speedBis;
            }
        }
Beispiel #23
0
        public void MakeBullet(Vector2 loc, Vector2 traj, bool background, Vector4 smokeColor, float smokeSize)
        {
            MakeBullet(loc, traj, background);

            AddParticle(new Smoke(loc, traj,
                                  smokeColor.X, smokeColor.Y, smokeColor.Z, smokeColor.W,
                                  smokeSize,
                                  RandomMachine.GetRandomInt(0, 4)), background);
        }
Beispiel #24
0
 public override void TodoOnFiring(Vector2 location)
 {
     for (int i = 0; i < 5; i++)
     {
         //White smoke
         TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(location, RandomMachine.GetRandomVector2(-20f, 20f, 20f, 20f),
                                                                    1.5f, 1.5f, 1.5f, 1f, RandomMachine.GetRandomFloat(1f, 2.5f), RandomMachine.GetRandomInt(0, 4)), false);
     }
 }
        /// <summary>
        /// Common initialisation for weapons
        /// </summary>
        /// <param name="randStart">Random the time of the first shot</param>
        protected Weapon(bool randStart)
        {
            lastShot     = randStart ? RandomMachine.GetRandomFloat(0f, 5000f) : 0.0f;
            upgradeLevel = 0;
            flip         = SpriteEffects.None;

            Rumble  = Vector2.Zero;
            MaxAmmo = InfiniteAmmo;
        }
 public override void TodoOnDeath()
 {
     TGPAContext.Instance.ParticleManager.AddParticle(new Fire(
                                                          Location + RandomMachine.GetRandomVector2(10.0f, 10.0f, -10.0f, 10.0f),
                                                          RandomMachine.GetRandomVector2(-30.0f, 30.0f, -10.0f, -5.0f),
                                                          RandomMachine.GetRandomFloat(0.25f, 0.5f),
                                                          RandomMachine.GetRandomInt(0, 4)));;
     base.TodoOnDeath();
 }
Beispiel #27
0
 public CrazyDocWaveWeapon()
     : base(true)
 {
     cooldown = 100.0f;
     name     = "CrazyDocWaveWeapon";
     damage   = 1;
     ammo     = InfiniteAmmo;
     angle    = RandomMachine.GetRandomFloat(0, Math.PI * 2);
 }
        public override List <Shot> Fire(Vector2 location)
        {
            List <Shot> newTirs = new List <Shot>();

            for (int i = 0; i < 5; i++)
            {
                newTirs.Add(new ElFeroCactaeWPNShot1(location, this, RandomMachine.GetRandomFloat(-(3 * Math.PI / 2), (3 * Math.PI / 2)), this.Flip));
            }
            return(newTirs);
        }
Beispiel #29
0
        public EsquimoWaveGun()
            : base(true)
        {
            cooldown = 200.0f;
            name     = "EsquimoWaveGun";
            damage   = 1;
            ammo     = InfiniteAmmo;

            randomSpace = RandomMachine.GetRandomInt(100, 200);
        }
        public override List <Shot> Fire(Vector2 location)
        {
            cooldown = RandomMachine.GetRandomFloat(250, 2500);

            List <Shot> newTirs = new List <Shot>();

            newTirs.Add(new SnowballLauncherShot(location, this, RandomMachine.GetRandomFloat(Math.PI / 16, 3 * Math.PI / 8), this.Flip));

            return(newTirs);
        }