diff --git a/AirFighter/DrawningAirplane.cs b/AirFighter/DrawningAirplane.cs index 9f481e5..984c2b3 100644 --- a/AirFighter/DrawningAirplane.cs +++ b/AirFighter/DrawningAirplane.cs @@ -55,7 +55,7 @@ width, int height, int airplaneWidth, int airplaneHeight) return; _startPosX = x; _startPosY = y; - if (x < 0 || y < 0 || x + _airplaneWidth >= _pictureWidth || y + _airplaneHeight >= _pictureHeight || y -_airplanewingHeight < 0 ) + if (x + _airplaneWidth >= _pictureWidth || y + _airplaneHeight >= _pictureHeight) { _startPosX = 1; _startPosY = (_airplanewingHeight+_airplanerwingkorpusHeight)/2; diff --git a/AirFighter/EntityAirFighter.cs b/AirFighter/EntityAirFighter.cs index fc9306e..ceecf1b 100644 --- a/AirFighter/EntityAirFighter.cs +++ b/AirFighter/EntityAirFighter.cs @@ -1,5 +1,4 @@ - -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/AirFighter/FormAirFighter.cs b/AirFighter/FormAirFighter.cs index d189937..c1d6bfa 100644 --- a/AirFighter/FormAirFighter.cs +++ b/AirFighter/FormAirFighter.cs @@ -1,7 +1,6 @@ using ProjectAirFighter.MovementStrategy; using ProjectAirFighter.DrawningObjects; - namespace ProjectAirFighter { public partial class FormAirFighter : Form @@ -34,7 +33,7 @@ namespace ProjectAirFighter random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height); - _drawningAirplane.SetPosition(random.Next(10, 100), random.Next(10, 100)); + _drawningAirplane.SetPosition(random.Next(10, 100), random.Next(70, 100)); Draw(); } @@ -48,7 +47,7 @@ namespace ProjectAirFighter Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height); - _drawningAirplane.SetPosition(random.Next(10, 100), random.Next(10,100)); + _drawningAirplane.SetPosition(random.Next(10, 100), random.Next(70, 100)); Draw(); } diff --git a/AirFighter/MoveToBorder.cs b/AirFighter/MoveToBorder.cs index 516f997..fed5469 100644 --- a/AirFighter/MoveToBorder.cs +++ b/AirFighter/MoveToBorder.cs @@ -9,7 +9,6 @@ namespace ProjectAirFighter.MovementStrategy { public class MoveToBorder : AbstractStrategy { - protected override bool IsTargetDestinaion() { var objParams = GetObjectParameters; @@ -19,7 +18,7 @@ namespace ProjectAirFighter.MovementStrategy return false; } - return objParams.RightBorder < FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth && + return objParams.RightBorder <= FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth && objParams.DownBorder + GetStep() >= FieldHeight; } diff --git a/AirFighter/Program.cs b/AirFighter/Program.cs index dba1ab3..e7a24a0 100644 --- a/AirFighter/Program.cs +++ b/AirFighter/Program.cs @@ -12,6 +12,4 @@ namespace ProjectAirFighter Application.Run(new FormAirFighter()); } } - - } \ No newline at end of file