/// <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 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; }
/// <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)) }
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 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 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); }
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 EsquimoWaveGun() : base(true) { cooldown = 200.0f; name = "EsquimoWaveGun"; damage = 1; ammo = InfiniteAmmo; randomSpace = RandomMachine.GetRandomInt(100, 200); }
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)); } } } }
public Sapin2(Vector2 location, float sc) : base(location, 18, new Rectangle(371, 1343, 551, 493), false) { this.Scale = new Vector2(sc, sc); this.Hitbox = new SquareHitbox(this, new Vector2(0.9f, 0.2f)); int rand = RandomMachine.GetRandomInt(0, 2); if (rand == 1) { this.Flip = SpriteEffects.FlipHorizontally; } }
public EarLaserWeapon() : base(true) { cooldown = 150.0f; name = "EarLaserWeapon"; damage = 1; ammo = InfiniteAmmo; fireAngle = Math.PI; fireDirectionDelta = RandomMachine.GetRandomInt(-1, 1); fireDirectionDelta = (fireDirectionDelta == -1) ? -0.20f : 0.20f; randomHole = RandomMachine.GetRandomInt(3, 6); currentShot = 0; }
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 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 List <Shot> Fire(Vector2 location) { List <Shot> newTirs = new List <Shot>(); Vector2 newLoc = location; newTirs.Add(new CowLauncherWeaponShot(newLoc, this, Math.PI / 2, this.Flip)); for (int i = 0; i < RandomMachine.GetRandomInt(2, 7); i++) { newLoc.X += 60; newLoc.Y -= 50; newTirs.Add(new CowLauncherWeaponShot(newLoc, this, Math.PI / 2, this.Flip)); } return(newTirs); }
public override void Update(GameTime gameTime) { //Aim a player int rand = RandomMachine.GetRandomInt(0, 1); if ((rand == 0) && (TGPAContext.Instance.Player2 != null)) { fireAngle = Angles.GetAngle(Vectors.ConvertPointToVector2(armDst.Center), Vectors.ConvertPointToVector2(TGPAContext.Instance.Player2.DstRect.Center)); } else { fireAngle = Angles.GetAngle(Vectors.ConvertPointToVector2(armDst.Center), Vectors.ConvertPointToVector2(TGPAContext.Instance.Player1.DstRect.Center)); } fireAngle -= (float)(Math.PI / 2); 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); }
public LanceTrucShot(Vector2 loc, LanceTruc wpn, double angle, SpriteEffects _flip) : base(loc, Rectangle.Empty, //Sprite new Vector2(550.0f, 450.0f), //Speed Vector2.One, //Scale _flip, wpn, angle, false) { //Random item between 12 ones (each one = 128*128 sprite) int x = RandomMachine.GetRandomInt(0, 768) / 128; int y = RandomMachine.GetRandomInt(0, 256) / 128; sRect = new Rectangle(128 * x, 742 + (128 * y), 128, 128); this.Scale = new Vector2(0.5f, 0.5f); bounce = true; ttl = 7000f; UseRotationWhenDrawing = true; }
public override void Update(GameTime gameTime) { fireCooldown -= (float)gameTime.ElapsedGameTime.TotalMilliseconds; if (fireCooldown <= 0f) //Reduce flame effect for performance issues { fireCooldown = 25f; //Flame effect Fire f = new Fire(this.location + RandomMachine.GetRandomVector2(5f, -5.0f, -10.0f, 10.0f), RandomMachine.GetRandomVector2(-5.0f, 5.0f, -2.0f, 2.0f), 1f, RandomMachine.GetRandomInt(0, 4)); f.Additive = false; TGPAContext.Instance.ParticleManager.AddParticle(f); } base.Update(gameTime); }
public override List <Shot> Fire(Vector2 location) { List <Shot> newTirs = new List <Shot>(); float fireAngle = 0.0f; int rand = RandomMachine.GetRandomInt(0, 1); if ((rand == 0) && (TGPAContext.Instance.Player2 != null)) { fireAngle = Angles.GetAngle(location, Vectors.ConvertPointToVector2(TGPAContext.Instance.Player2.DstRect.Center)); } else { fireAngle = Angles.GetAngle(location, Vectors.ConvertPointToVector2(TGPAContext.Instance.Player1.DstRect.Center)); } fireAngle += (float)(Math.PI + RandomMachine.GetRandomFloat(Math.PI / 8, -Math.PI / 8)); newTirs.Add(new PingouinLauncherWeaponShot(location, this, -fireAngle, this.Flip)); return(newTirs); }
/// <summary> /// Update angle to aim player /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { Vector2 tmplocation = location - structureLinkPoint; Vector2 firstReactorLoc = tmplocation + firstReactorRelativeLoc; Vector2 secondReactorLoc = tmplocation + secondReactorRelativeLoc; int rand = RandomMachine.GetRandomInt(0, 1); if ((rand == 0) && (TGPAContext.Instance.Player2 != null)) { fireAngle = Angles.GetAngle(this.Location, Vectors.ConvertPointToVector2(TGPAContext.Instance.Player2.DstRect.Center)); } else { fireAngle = Angles.GetAngle(this.Location, Vectors.ConvertPointToVector2(TGPAContext.Instance.Player1.DstRect.Center)); } //Jetpacks for plateform TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(firstReactorLoc, RandomMachine.GetRandomVector2(-4f, 4f, 10f, 40f), 0.30f, 0.30f, 0.30f, 1f, RandomMachine.GetRandomFloat(0.1f, .3f), RandomMachine.GetRandomInt(0, 4)), true); Fire f = new Fire(firstReactorLoc, RandomMachine.GetRandomVector2(-10f, 10f, 10f, 40f), 0.25f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(f, true); TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(secondReactorLoc, RandomMachine.GetRandomVector2(-4f, 4f, 10f, 40f), 0.30f, 0.30f, 0.30f, 1f, RandomMachine.GetRandomFloat(0.1f, .3f), RandomMachine.GetRandomInt(0, 4)), true); f = new Fire(secondReactorLoc, RandomMachine.GetRandomVector2(-10f, 10f, 10f, 40f), 0.25f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(f, true); base.Update(gameTime); }
public PoulpiZombie(Vector2 loc, Vector2 scroll, Bonus bonus, MovePattern pattern, SpriteEffects flip, String[] flags) : base(loc, scroll, bonus, pattern, flags, flip, new Rectangle(0, 0, 322, 251), //Source sprite new Vector2(35.0f, 35.0f), //Speed new Vector2(0.25f, 0.25f), null //No weapon, it's a zombie ) { //Stats hp = 12; points = 200; Difficulty = 10; this.ttl = 60000; UseAnimation = true; this.totalFrameNumber = 2; this.frameCooldown = 500; this.spriteBox = new Vector2(320, 256); this.currentFrame = RandomMachine.GetRandomInt(0, 1); this.hitbox = new CircleHitbox(this, false, 2f); }
public override void Update(GameTime gameTime) { if (!Dead) { if (hp < 100) { Vector2 newLoc = location; newLoc.X += 70; newLoc.Y += 300; TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(newLoc, RandomMachine.GetRandomVector2(-10f, 10f, 10f, 50f), 0.60f, 0.60f, 0.60f, 1f, RandomMachine.GetRandomFloat(0.1f, .3f), RandomMachine.GetRandomInt(0, 4)), true); Fire f = new Fire(newLoc, RandomMachine.GetRandomVector2(-4f, 4f, 10f, 90f), 0.25f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(f, true); } } base.Update(gameTime); }
/// <summary> /// Don't want to chose a weapon ? Use this method, it will give you a random one /// </summary> /// <returns>A random WeaponType(or nothing if you are unlucky)</returns> public static Weapon GetRandomWeapon() { int wpn = RandomMachine.GetRandomInt(0, 9); if (wpn < 3) { return(new MachineGun()); } else if (wpn < 6) { return(new Flamethrower()); } else if (wpn < 9) { return(new RocketLauncher()); } else if (wpn == 9) { return(new Megabomb()); } return(new MachineGun()); }
public override void Update(GameTime gameTime) { //Speed up ! speed += Vector2.One * 10; if (TGPAContext.Instance.Cheatcodes.IsKawaii) { //Contrail TGPAContext.Instance.ParticleManager.AddParticle(new HeartWave(Vectors.ConvertPointToVector2(DstRect.Center), RandomMachine.GetRandomVector2(-3f, 7f, -10f, 10f), RandomMachine.GetRandomFloat(0.1f, .2f), RandomMachine.GetRandomInt(0, 4)), true); } else { //Contrail TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(Vectors.ConvertPointToVector2(DstRect.Center), RandomMachine.GetRandomVector2(-3f, 7f, -10f, 10f), 1.0f, 1.0f, 1.0f, 1f, RandomMachine.GetRandomFloat(0.1f, .2f), RandomMachine.GetRandomInt(0, 4)), true); } base.Update(gameTime); }
public override void Update(GameTime gameTime) { double tmp = rotation; rotation = saveRotation; base.Update(gameTime); rotation = tmp; rotation += 0.10f; //Fire and smoke Vector2 loc = Vectors.ConvertPointToVector2(DstRect.Center); TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(loc, RandomMachine.GetRandomVector2(3f, 5f, -5f, 5f), 0.30f, 0.30f, 0.30f, 1f, RandomMachine.GetRandomFloat(0.01f, .03f), RandomMachine.GetRandomInt(0, 4)), true); Fire f = new Fire(loc, RandomMachine.GetRandomVector2(3f, 5f, -5f, 5f), 0.25f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(f, true); }
public Cow(Vector2 loc, Vector2 scroll, Bonus bonus, MovePattern pattern, SpriteEffects flip, String[] flags) : base(loc, scroll, bonus, pattern, flags, flip, new Rectangle(0, 0, 250, 178), //Source sprite Vector2.Zero, //Speed Vector2.One, null ) { //Stats hp = 17; points = 1000; Difficulty = 1; this.Background = true; UseAnimation = true; this.totalFrameNumber = 3; this.frameCooldown = 2000; this.spriteBox = new Vector2(256, 256); this.currentFrame = RandomMachine.GetRandomInt(0, 2); this.ttl = InfiniteTimeToLive; this.hitbox = new CircleHitbox(this, false, 2f); }
/// <summary> /// Return a random position on the screen corner and borner /// </summary> /// <returns></returns> public Vector2 RandomScreenBorderPosition() { int border = RandomMachine.GetRandomInt(0, 3); switch (border) { //Right case 0: return(new Vector2(1, RandomMachine.GetRandomFloat(0.2, 0.8))); //Down case 1: return(new Vector2(RandomMachine.GetRandomFloat(0.2, 0.8), 1)); //Left case 2: return(new Vector2(0, RandomMachine.GetRandomFloat(0.2, 0.8))); //Up default: case 3: return(new Vector2(RandomMachine.GetRandomFloat(0.2, 0.8), 0)); } }