This is related to the first question that I asked about making infinite missile
Now what I wanted to do now is when my Main Tank changes direction, let's say it turns right. Supposedly when it fires it will travel to the side where the Tank is facing. I can't figure it out much since like it was coded on a Timer.
private void ShootMissile()
{
var missile = new PictureBox();
this.Controls.Add(missile);
missile.Width = 10;
missile.Height = 10;
missile.BackColor = Color.Black;
missile.Top = MainTank.Top + MainTank.Height / 2 - missile.Height / 2;
missile.Left = MainTank.Left + MainTank.Width / 2 - missile.Width / 2;
missile.BringToFront();
missiles.Add(missile);
}
private void shootingTimer_Tick(object sender, EventArgs e)
{
foreach(var missile in missiles)
{
missile.Top -= 5;
}
}