private void laserTimer_Tick(object sender, EventArgs e) { ObstacleLine line = new ObstacleLine(this.Width, this.Height); lines.addLine(line); if (laser1.Location.X == this.Width - laser1.Width || laser1.Location.X == 0) { n1 = n1 * (-1); } if (laser2.Location.X == this.Width - laser2.Width || laser2.Location.X == 0) { n2 = n2 * (-1); } if (laser3.Location.X == this.Width - laser3.Width || laser3.Location.X == 0) { n3 = n3 * (-1); } if (laser4.Location.X == this.Width - laser4.Width || laser4.Location.X == 0) { n4 = n4 * (-1); } laser1.Left = laser1.Location.X + 1 * n1; laser2.Left = laser2.Location.X + 1 * n2; laser3.Left = laser3.Location.X + 1 * n3; laser4.Left = laser4.Location.X + 1 * n4; Invalidate(true); }
public void addLine(ObstacleLine line) { // if (lines.Count <= 20) lines.Add(line); }