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); }
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 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; }
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 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))); } } }
/// <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))); } }
/// <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)) }
/// <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 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); }
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); }
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 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); }
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); }
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); }
public CrazyDocWaveWeapon() : base(true) { cooldown = 100.0f; name = "CrazyDocWaveWeapon"; damage = 1; ammo = InfiniteAmmo; angle = RandomMachine.GetRandomFloat(0, Math.PI * 2); }
/// <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(); }
/// <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; } }
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); }
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); }
public FlamethrowerShot(Vector2 loc, Flamethrower wpn, double angle, SpriteEffects _flip) : base(loc, Rectangle.Empty, //Sprite new Vector2(1200.0f, 1200.0f), //Speed Vector2.One, //Scale _flip, wpn, angle, false) { ttl = 300; dRect = ComputeDstRect(new Rectangle(0, 0, 350, 350)); fireCooldown = RandomMachine.GetRandomFloat(0f, 25f); }
public MuzzleFlash(Vector2 loc, Vector2 traj, float size, Color _color) : base(_color.R, _color.G, _color.B) { location = loc; trajectory = traj; this.size = size; rotation = RandomMachine.GetRandomFloat(0f, 6.28f); Exists = true; frame = 0.05f; Additive = false; }
public override List <Shot> Fire(Vector2 location) { List <Shot> newTirs = new List <Shot>(); cooldown = RandomMachine.GetRandomFloat(250f, 1200f); CrazyDocShot shot = new CrazyDocShot(location, this, RandomMachine.GetRandomFloat(0, Math.PI * 2), this.Flip); newTirs.Add(shot); return(newTirs); }
public override void Update(GameTime gameTime) { this.visualRotation += 0.15f; this.rotation -= RandomMachine.GetRandomFloat(0.001f, 0.01f); Snow s = new Snow(this.location, RandomMachine.GetRandomVector2(-10f, 10f, -10f, 10f), 1f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(s, true); base.Update(gameTime); }
public override void Update(GameTime gameTime) { this.Removable = false; if (hp > 0) { //Toxic smoke foreach (Vector2 v in barrelsLoc) { Vector2 v2 = v + location; TGPAContext.Instance.ParticleManager.AddParticle( new Smoke(v2, RandomMachine.GetRandomVector2(2f, 10f, 0f, -150f), 0.10f, 1f, 0.10f, 1f, RandomMachine.GetRandomFloat(2f, 3f), RandomMachine.GetRandomInt(0, 4)) , true); } base.Update(gameTime); } else { Vector2 boomLoc = RandomMachine.GetRandomVector2(dRect.Left, dRect.Right, dRect.Top, dRect.Bottom); TGPAContext.Instance.ParticleManager.MakeExplosion(boomLoc, 20f); for (int i = 0; i < 3; i++) { boomLoc = RandomMachine.GetRandomVector2(TGPAContext.Instance.TitleSafeArea.Left, TGPAContext.Instance.TitleSafeArea.Right, TGPAContext.Instance.TitleSafeArea.Top, TGPAContext.Instance.TitleSafeArea.Bottom); TGPAContext.Instance.ParticleManager.AddParticle( new Smoke(boomLoc, RandomMachine.GetRandomVector2(2f, 10f, 0f, -150f), 0.10f, 1f, 0.10f, 1f, RandomMachine.GetRandomFloat(30f, 70f), RandomMachine.GetRandomInt(0, 4)) , true); } this.location.Y += 0.25f; this.location.X += this.deltaX; this.deltaX = -this.deltaX; if (TGPAContext.Instance.Map.Ended == Map.EndMode.None) { TGPAContext.Instance.Player1.SetRumble(new Vector2(0.7f, 0.7f)); if (TGPAContext.Instance.Player2 != null) { TGPAContext.Instance.Player2.SetRumble(new Vector2(0.7f, 0.7f)); } } } }
private void Launch() { for (int i = 0; i < RandomMachine.GetRandomInt(1, 4); i++) { BadGuy rock = new Rock(new Vector2(RandomMachine.GetRandomInt(0, TGPAContext.Instance.ScreenWidth + 1), 0), Vector2.Zero, null, null, SpriteEffects.None, null); rock.Location -= new Vector2(0, rock.DstRect.Height); float f = RandomMachine.GetRandomFloat(0.5f, 2.25f); rock.Scale = new Vector2(f, f); rock.HP = (int)(rock.HP * f) + 1; TGPAContext.Instance.AddEnemy(rock); } }
public override void TodoOnFiring(Vector2 location) { //Erase parameters location = parent.Location - (parent.StructureLinkPoint / 2); for (int i = 0; i < 5; i++) { //Smoke and fire TGPAContext.Instance.ParticleManager.AddParticle(new Fire(location, RandomMachine.GetRandomVector2(-20f, 20f, 20f, 20f) , RandomMachine.GetRandomFloat(0.5f, 1.5f), RandomMachine.GetRandomInt(0, 4)), false); TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(location, RandomMachine.GetRandomVector2(-20f, 20f, 20f, 20f), 0.2f, 0.2f, 0.2f, 1f, RandomMachine.GetRandomFloat(1f, 2.5f), RandomMachine.GetRandomInt(0, 4)), false); } }
public CowLauncherWeaponShot(Vector2 loc, CowLauncherWeapon wpn, double angle, SpriteEffects _flip) : base(loc, new Rectangle(495, 315, 490, 355), //Sprite new Vector2(0, -400), //Speed new Vector2(0.25f, 0.25f), //Scale _flip, wpn, angle, true) { this.UseRotationWhenDrawing = true; this.saveRotation = angle; this.rotationDelta = RandomMachine.GetRandomFloat(-0.2f, 0.2f); this.hitbox = new CircleHitbox(this, true, 2f); this.Destructable = true; this.Points = 250; this.Hp = 5; }
public override void Update(GameTime gameTime) { Vector2 loc = Vectors.ConvertPointToVector2(DstRect.Center); //Add Smoke and fire TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(loc, RandomMachine.GetRandomVector2(-1f, 1f, -2f, 2f), 0.30f, 0.30f, 0.30f, 1f, RandomMachine.GetRandomFloat(0.01f, .03f), RandomMachine.GetRandomInt(0, 4)), true); Fire f = new Fire(loc, RandomMachine.GetRandomVector2(-1f, 1f, -2f, 2f), 0.25f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(f, true); base.Update(gameTime); }
public override void Update(GameTime gameTime) { Vector2 jetpackLoc = new Vector2(location.X + 70, location.Y + 60); Vector2 direction = (flips == SpriteEffects.FlipHorizontally ? new Vector2(-1, 1) : Vector2.One); //Add fire to his jetpack ! Aïe Caramba ! TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(jetpackLoc, RandomMachine.GetRandomVector2(3f, 7f, 10f, 40f) * direction, 0.30f, 0.30f, 0.30f, 1f, RandomMachine.GetRandomFloat(0.1f, .3f), RandomMachine.GetRandomInt(0, 4)), true); Fire f = new Fire(jetpackLoc, RandomMachine.GetRandomVector2(10f, 10f, 10f, 40f) * direction, 0.25f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(f, true); base.Update(gameTime); }