public override Vector2 Move(GameEngineBehaviors b, Vector2 V, List <GameEngine> A) { base.Move(b, V, A); timer += GameEngine.gameTime.ElapsedGameTime; if (b.Position.X < GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2 && direction.Y > 0) { direction.X += 0.0005f; } else if (b.Position.X >= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2 && direction.Y > 0) { direction.X -= 0.0005f; } else if (timer <= TimeSpan.FromSeconds(5)) { return(b.Position); } if (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 4 < b.Position.Y) { direction.Y -= 0.005f; } return(b.Position + direction); }
private void trackingBullet(GameEngineBehaviors b) { trackingShotting_pause += GameEngine.gameTime.ElapsedGameTime; string trackingShotting_pause_string = trackingShotting_pause.TotalSeconds.ToString(); double trackingShotting_pause_double = 0; double.TryParse(trackingShotting_pause_string, out trackingShotting_pause_double); if (trackingShotting_pause < TimeSpan.FromSeconds(1)) { trackingShotting += GameEngine.gameTime.ElapsedGameTime; if (trackingShotting > TimeSpan.FromSeconds(0.02)) { trackingShotting -= TimeSpan.FromSeconds(0.02); //shot point #1 double angle = Math.PI * 3 * trackingShotting_pause_double; double turn_x = b.Position.X + 170 * Math.Sin(angle) * trackingShotting_pause_double; double turn_y = b.Position.Y - 170 * Math.Cos(angle) * trackingShotting_pause_double; Vector2 shotting_point = new Vector2((float)turn_x, (float)turn_y); //bullet move #1 double f_x = 0; double f_y = 0; double target_x = GameEngine.Player.Position.X; double target_y = GameEngine.Player.Position.Y; double shot_x = turn_x; double shot_y = turn_y; f_x = (target_x - shot_x) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); f_y = (target_y - shot_y) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); //bullet #1 new Bullet(b, Images.tracking_Bullet, new Vector2(15, 25), new EnemyBulletBehavior(.5f), new Vector2((float)f_x, (float)f_y), shotting_point); //shot point #2 angle = Math.PI * 3 * trackingShotting_pause_double; turn_x = b.Position.X - 170 * Math.Sin(angle) * trackingShotting_pause_double; turn_y = b.Position.Y + 170 * Math.Cos(angle) * trackingShotting_pause_double; shotting_point = new Vector2((float)turn_x, (float)turn_y); //bullet move #2 f_x = 0; f_y = 0; target_x = GameEngine.Player.Position.X; target_y = GameEngine.Player.Position.Y; shot_x = turn_x; shot_y = turn_y; f_x = (target_x - shot_x) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); f_y = (target_y - shot_y) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); //bullet #2 new Bullet(b, Images.tracking_Bullet, new Vector2(15, 25), new EnemyBulletBehavior(.1f), new Vector2((float)f_x, (float)f_y), shotting_point); } } if (trackingShotting_pause > TimeSpan.FromSeconds(4)) { trackingShotting_pause = TimeSpan.Zero; } }
public virtual Vector2 Move(GameEngineBehaviors b, Vector2 V, List <GameEngine> A) { if (attacks != null) { attacks.Shoot(b); } return(b.Position + V); }
public override void Shoot(GameEngineBehaviors b) { scatterShooting += GameEngine.gameTime.ElapsedGameTime; if (scatterShooting > TimeSpan.FromSeconds(4)) { scatterShooting -= TimeSpan.FromSeconds(4); ScatterTwoBullets(b); } }
public override void Shoot(GameEngineBehaviors b) { gametimepassed += GameEngine.gameTime.ElapsedGameTime; if (gametimepassed > TimeSpan.FromSeconds(timeInterval_Second)) { gametimepassed -= TimeSpan.FromSeconds(timeInterval_Second); new Bullet(b, Images.EnemyBullet, DefaultSizes.DefaultBulletSize, new EnemyBulletBehavior(), new Vector2(0, 1)); } }
public override Vector2 Move(GameEngineBehaviors b, Vector2 V, List <GameEngine> A) { base.Move(b, V, A); timer += GameEngine.gameTime.ElapsedGameTime; direction.Y = 1f; return(b.Position + direction); }
public override void Shoot(GameEngineBehaviors b) { if (stages != null) { foreach (Attack i in stages) { i.Shoot(b); } } }
public override void Shoot(GameEngineBehaviors b) { shooting.Shoot(b); if (!Summoned && (b as Character).Lives == 1234) { //surprise Summoned = true; float h = (float)((double)Images.MidBossCompanion.Height / Images.MidBossCompanion.Width) * GameEngine.graphic.PreferredBackBufferWidth; new Enemy(Images.MidBossCompanion, new Vector2(GameEngine.graphic.PreferredBackBufferWidth, h), new Vector2(0, -h + 1), new Vector2(0, 5), null, 1234); } }
private void wallBullet(GameEngineBehaviors b) { //random shotting Random rd = new Random(); wallBulletShotting_pause += GameEngine.gameTime.ElapsedGameTime; string wallBulletShotting_pause_string = wallBulletShotting_pause.TotalSeconds.ToString(); double wallBulletShotting_pause_double = 0; double.TryParse(wallBulletShotting_pause_string, out wallBulletShotting_pause_double); wallBulletShotting += GameEngine.gameTime.ElapsedGameTime; if (wallBulletShotting_pause < TimeSpan.FromSeconds(3)) { if (wallBulletShotting < TimeSpan.FromSeconds(1)) { //shot point double turn_x = b.Position.X + rd.Next(-25, 25); double turn_y = b.Position.Y - rd.Next(-25, 25); Vector2 shotting_point = new Vector2((float)turn_x, (float)turn_y); //bullet move double rd_num_x = rd.Next(1, GameEngine.graphic.PreferredBackBufferWidth); double rd_num_y = rd.Next(1, GameEngine.graphic.PreferredBackBufferHeight / 2); double f_x = 0; double f_y = 0; double target_x = rd_num_x; double target_y = rd_num_y; double shot_x = b.Position.X; double shot_y = b.Position.Y; f_x = (target_x - shot_x) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); f_y = (target_y - shot_y) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); // new Bullet(b, Images.tracking_Bullet, new Vector2(15, 25), new EnemyBulletBehavior(), new Vector2((float)f_x, (float)f_y), shotting_point); new Bullet(b, Images.Scattershot_Bullet_wall, new Vector2(15, 25), new EnemyBulletBehavior(.005f), new Vector2((float)1, (float)1), new Vector2((float)b.Position.X, (float)25 + b.Position.Y)); new Bullet(b, Images.Scattershot_Bullet_wall, new Vector2(15, 25), new EnemyBulletBehavior(.005f), new Vector2((float).5, (float).5), new Vector2((float)-15 + b.Position.X, (float)0 + b.Position.Y)); new Bullet(b, Images.Scattershot_Bullet_wall, new Vector2(15, 25), new EnemyBulletBehavior(.005f), new Vector2((float)1, (float)-1), new Vector2((float)2 + b.Position.X, (float)12 + b.Position.Y)); new Bullet(b, Images.Scattershot_Bullet_wall, new Vector2(15, 25), new EnemyBulletBehavior(.005f), new Vector2((float)-1, (float)1), new Vector2((float)15 + b.Position.X, (float)-6 + b.Position.Y)); new Bullet(b, Images.Scattershot_Bullet_wall, new Vector2(15, 25), new EnemyBulletBehavior(.005f), new Vector2((float)-1, (float)-1), new Vector2((float)-9 + b.Position.X, (float)33 + b.Position.Y)); } } if (wallBulletShotting_pause > TimeSpan.FromSeconds(8)) { wallBulletShotting_pause = TimeSpan.Zero; wallBulletShotting = TimeSpan.Zero; } }
private void ScatterTwoBullets(GameEngineBehaviors b) { double angle = 2 * Math.PI / 24; double f_x = 0; double f_y = 0; for (int i = 1; i <= 2 * Math.PI / angle; i++) { f_x = Math.Sin(angle * i); f_y = Math.Cos(angle * i); new BulletScatterTwo(b, new Vector2((float)f_x, (float)f_y)); } }
private void scatterBullet(GameEngineBehaviors b) { scatterShotting += GameEngine.gameTime.ElapsedGameTime; if (scatterShotting > TimeSpan.FromSeconds(2)) { scatterShotting -= TimeSpan.FromSeconds(2); double angle = 2 * Math.PI / 24; double f_x = 0; double f_y = 0; for (int i = 1; i <= 2 * Math.PI / angle; i++) { f_x = Math.Sin(angle * i); f_y = Math.Cos(angle * i); new Bullet(b, Images.Scattershot_bullet, DefaultSizes.DefaultBulletSize, new EnemyBulletBehavior(), new Vector2((float)f_x, (float)f_y)); } } }
public override Vector2 Move(GameEngineBehaviors b, Vector2 V, List <GameEngine> A) { if (i != null) { if (!b.isDisposed) { i.Play(); i = null; } else { i.Stop(); i.Dispose(); } } return(b.Position + V); }
public override Vector2 Move(GameEngineBehaviors b, Vector2 V, List <GameEngine> A) { base.Move(b, V, A); timer += GameEngine.gameTime.ElapsedGameTime; if (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 5 < b.Position.Y && direction.X <= 1) { direction.X += 0.005f; } if (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 4 < b.Position.Y && direction.Y >= 0) { direction.Y -= 0.005f; } return(b.Position + direction); }
private void triangleBullet(GameEngineBehaviors b) { triangleShotting += GameEngine.gameTime.ElapsedGameTime; if (triangleShotting > TimeSpan.FromSeconds(1)) { triangleShotting -= TimeSpan.FromSeconds(1); double turn_x = b.Position.X; double turn_y = b.Position.Y; Vector2 shotting_point = new Vector2((float)turn_x, (float)turn_y); //bullet move #1 double f_x = 0; double f_y = 0; double target_x = GameEngine.Player.Position.X; double target_y = GameEngine.Player.Position.Y; double shot_x = turn_x; double shot_y = turn_y; f_x = (target_x - shot_x) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); f_y = (target_y - shot_y) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); //bullet #1 new Bullet(b, Images.tracking_Bullet, new Vector2(15, 25), new EnemyBulletBehavior(.5f), new Vector2((float)f_x, (float)f_y), shotting_point); target_x = GameEngine.Player.Position.X - 200; target_y = GameEngine.Player.Position.Y - 200; shot_x = turn_x; shot_y = turn_y; f_x = (target_x - shot_x) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); f_y = (target_y - shot_y) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); //bullet #2 new Bullet(b, Images.tracking_Bullet, new Vector2(15, 25), new EnemyBulletBehavior(.5f), new Vector2((float)f_x, (float)f_y), shotting_point); target_x = GameEngine.Player.Position.X + 200; target_y = GameEngine.Player.Position.Y + 200; shot_x = turn_x; shot_y = turn_y; f_x = (target_x - shot_x) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); f_y = (target_y - shot_y) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); //bullet #3 new Bullet(b, Images.tracking_Bullet, new Vector2(15, 25), new EnemyBulletBehavior(.5f), new Vector2((float)f_x, (float)f_y), shotting_point); } }
private void randomBullet(GameEngineBehaviors b) { //random shotting Random rd = new Random(); randomShotting_pause += GameEngine.gameTime.ElapsedGameTime; string randomShotting_pause_string = randomShotting_pause.TotalSeconds.ToString(); double randomShotting_pause_double = 0; double.TryParse(randomShotting_pause_string, out randomShotting_pause_double); randomShotting += GameEngine.gameTime.ElapsedGameTime; if (randomShotting_pause < TimeSpan.FromSeconds(3)) { if (randomShotting > TimeSpan.FromSeconds(0.01)) { randomShotting -= TimeSpan.FromSeconds(0.01); //shot point double angle = Math.PI * 3 * randomShotting_pause_double; double turn_x = b.Position.X + 25 * Math.Sin(angle) * randomShotting_pause_double; double turn_y = b.Position.Y - 25 * Math.Cos(angle) * randomShotting_pause_double; Vector2 shotting_point = new Vector2((float)turn_x, (float)turn_y); //bullet move double rd_num_x = rd.Next(1, GameEngine.graphic.PreferredBackBufferWidth); double rd_num_y = rd.Next(1, GameEngine.graphic.PreferredBackBufferHeight); double f_x = 0; double f_y = 0; double target_x = rd_num_x; double target_y = rd_num_y; double shot_x = b.Position.X; double shot_y = b.Position.Y; f_x = (target_x - shot_x) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); f_y = (target_y - shot_y) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); new Bullet(b, Images.tracking_Bullet, new Vector2(15, 25), new EnemyBulletBehavior(.005f), new Vector2((float)f_x, (float)f_y), shotting_point); } } if (randomShotting_pause > TimeSpan.FromSeconds(8)) { randomShotting_pause = TimeSpan.Zero; } }
private void triangleBullet2(GameEngineBehaviors b)//backup, for emergency { triangleShotting_pause += GameEngine.gameTime.ElapsedGameTime; string triangleShotting_pause_string = triangleShotting_pause.TotalSeconds.ToString(); double triangleShotting_pause_double = 0; double.TryParse(triangleShotting_pause_string, out triangleShotting_pause_double); if (triangleShotting_pause < TimeSpan.FromSeconds(1)) { triangleShotting += GameEngine.gameTime.ElapsedGameTime; if (triangleShotting > TimeSpan.FromSeconds(0.2)) { triangleShotting -= TimeSpan.FromSeconds(0.2); double turn_x = b.Position.X; double turn_y = b.Position.Y; Vector2 shotting_point = new Vector2((float)turn_x, (float)turn_y); //bullet move #1 double f_x = 0; double f_y = 0; double target_x = GameEngine.Player.Position.X + triangleShotting_pause_double * 4000; double target_y = GameEngine.Player.Position.Y + triangleShotting_pause_double * 4000; double shot_x = turn_x; double shot_y = turn_y; f_x = (target_x - shot_x) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); f_y = (target_y - shot_y) / Math.Sqrt((target_x - shot_x) * (target_x - shot_x) + (target_y - shot_y) * (target_y - shot_y)); //bullet #1 new Bullet(b, Images.tracking_Bullet, new Vector2(15, 25), new EnemyBulletBehavior(.5f), new Vector2((float)f_x, (float)f_y), shotting_point); } } if (triangleShotting_pause > TimeSpan.FromSeconds(4)) { triangleShotting_pause = TimeSpan.Zero; } }
public override void Shoot(GameEngineBehaviors b) { this.randomBullet(b); }
public override Vector2 Move(GameEngineBehaviors b, Vector2 V, List <GameEngine> A) { timer += GameEngine.gameTime.ElapsedGameTime; if (!inPlace) { Vector2 movement = b.Position + new Vector2(0, V.X + V.Y); if (movement.Y > Place.Y) { timer = TimeSpan.Zero; inPlace = true; return(b.Position); } return(movement); } else { Random rd = new Random(); float rd_num = (rd.Next(0, 100)) / 300f; // need random number for final boss move tracker += GameEngine.gameTime.ElapsedGameTime; if (timer < TimeSpan.FromSeconds(2)) { direction.X = -.3f + rd_num; direction.Y = .3f - rd_num; } if (timer >= TimeSpan.FromSeconds(2) && timer < TimeSpan.FromSeconds(4)) { direction.X = .3f - rd_num; direction.Y = .3f - rd_num; } if (timer >= TimeSpan.FromSeconds(4) && timer < TimeSpan.FromSeconds(6)) { direction.X = .3f - rd_num; direction.Y = -.3f + rd_num; } if (timer >= TimeSpan.FromSeconds(6) && timer < TimeSpan.FromSeconds(8)) { direction.X = -.3f + rd_num; direction.Y = -.3f + rd_num; } if (timer >= TimeSpan.FromSeconds(8)) { timer = TimeSpan.Zero; //reset timespan to 0 } if ((b.Position.X <= 100 || b.Position.X >= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width - 100)) { return(new Vector2(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2, b.Position.Y)); } if ((b.Position.Y <= 0 || b.Position.Y >= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height)) { return(new Vector2(b.Position.X, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 4)); } if ((b as Character).Lives <= lifeSpan || tracker >= interval) { //Next Stage stages.Dequeue(); tracker = TimeSpan.Zero; updateNextTime(lifeSpan); } if (stages.Count > 0) { //current stage behavior stages.Peek().Shoot(b); } else { //all stages done, boss dies b.Die(); } return(new Vector2(b.Position.X + direction.X, b.Position.Y + direction.Y)); } }
public BulletScatterTwo(GameEngineBehaviors b, Vector2 V, float v = .6f) : base(b, Images.MyBullet, DefaultSizes.DefaultBulletSize, null, V) { i.IsLooped = false; i.Volume = v; }
public override void Shoot(GameEngineBehaviors b) { this.scatterBullet(b); }
public override void Shoot(GameEngineBehaviors b) { trackingBullet_mode2(b); }
public virtual void Shoot(GameEngineBehaviors b) { }
public override void Shoot(GameEngineBehaviors b) { this.trackingBullet(b); }
public override void Shoot(GameEngineBehaviors b) { this.triangleBullet(b); }