public void UpdatePosition_WanderingBullet_SinDown_Success() { Wandering_Bullet test = new Wandering_Bullet(20, 20, pattern.Sindown); test.UpdatePosition(); Assert.IsTrue(test.X > 20); Assert.IsTrue(test.Y < 20); }
// creates two bullets moving in sin and -sin patterns //ship: position data // enemies are currently unsupported public void Make_HelixShot(Entity ship) //broken: Noah Mansfield { if (ship is Player) { //play a sound var sound = new MediaPlayer(); sound.Open(new Uri(System.Environment.CurrentDirectory + "/Resources/Shoot1.wav", UriKind.Absolute)); Application.Current.Dispatcher.BeginInvoke(new Action(() => sound.Play())); double y = ship.Y + 10; double x = ship.X + 50; //make the bullets Wandering_Bullet b_cos = new Wandering_Bullet(x, y, pattern.Sin); Wandering_Bullet b_sin = new Wandering_Bullet(x, y, pattern.Sindown); gameCtrl.player_fire.Add(b_cos); gameCtrl.player_fire.Add(b_sin); //make the images Image img_cos = new Image() { Source = new BitmapImage(new Uri("images/" + "P_bullet.png", UriKind.Relative)) }; Image img_sin = new Image() { Source = new BitmapImage(new Uri("images/" + "P_bullet.png", UriKind.Relative)) }; img_sin.Width = 20; img_cos.Width = 20; //link the images and bullets together Icon i_cos = new Icon() { i = img_cos, e = b_cos }; Icon i_sin = new Icon() { i = img_sin, e = b_sin }; i_cos.update(); i_sin.update(); //add images to the world WorldCanvas.Children.Add(img_cos); WorldCanvas.Children.Add(img_sin); icons.Add(i_cos); icons.Add(i_sin); } }
public void UpdatePosition_WanderingBullet_OutofBounds_Despawn() { Wandering_Bullet test = new Wandering_Bullet(9000, 20, pattern.Sin); test.id = ID.Hostile; test.UpdatePosition(); Assert.IsTrue(test.alive == false); test.alive = true; test = new Wandering_Bullet(-9000, 20, pattern.Sin); test.UpdatePosition(); Assert.IsTrue(test.alive == false); }