public Bullet(Vector2 loc, Vector2 traj) : base(1f, 0.8f, 0.6f) { location = loc; trajectory = traj; Exists = true; frame = 0.5f; Additive = true; rotation = Angles.GetAngle(Vector2.Zero, traj); this.a = 0.2f; }
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 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 override void Update(float gameTime, ParticleManager pMan) { if (frame < 0.5f) { if (trajectory.Y < -10.0f) { trajectory.Y += gameTime * 500.0f; } if (trajectory.X < -10.0f) { trajectory.X += gameTime * 150.0f; } if (trajectory.Y > 10.0f) { trajectory.Y += gameTime * 150.0f; } } rotation = Angles.GetAngle(location, trajectory); base.Update(gameTime, pMan); }