fix strategies

This commit is contained in:
ShabOl 2023-12-10 17:07:30 +04:00
parent 3c3fe9a53f
commit c5a1a44785
3 changed files with 7 additions and 7 deletions

View File

@ -85,7 +85,7 @@ public class BomberForm extends JFrame
break;
case 1:
_strategy = new MoveToCenterStrategy();
_strategy = new MoveToDownRightStrategy();
break;
default:
@ -165,7 +165,7 @@ public class BomberForm extends JFrame
// ButtonCreateBomberBase
//
ButtonCreateBomberBase.setName("ButtonCreateBomberBase");
ButtonCreateBomberBase.setBounds(177, 407, 159, 42);
ButtonCreateBomberBase.setBounds(12, 383, 260, 30);
ButtonCreateBomberBase.setText("Создать бомбардировщик");
ButtonCreateBomberBase.setBackground(new Color(225, 225, 225));
ButtonCreateBomberBase.setFont(new Font("Segoe UI", Font.PLAIN, 11));
@ -221,7 +221,7 @@ public class BomberForm extends JFrame
// ButtonCreateBomber
//
ButtonCreateBomber.setName("ButtonCreateBomber");
ButtonCreateBomber.setBounds(12, 407, 159, 42);
ButtonCreateBomber.setBounds(12, 419, 260, 30);
ButtonCreateBomber.setText("Создать продвинутый бомбардировщик");
ButtonCreateBomber.setBackground(new Color(225, 225, 225));
ButtonCreateBomber.setFont(new Font("Segoe UI", Font.PLAIN, 11));

View File

@ -25,7 +25,7 @@ public class MoveToCenterStrategy extends AbstractStrategy
return;
float diffX = ObjParams.ObjectMiddleHorizontal() - FieldWidth / 2;
if (Math.abs(diffX) > GetStep())
if (Math.abs(diffX) >= GetStep())
{
if (diffX > 0)
MoveLeft();
@ -34,7 +34,7 @@ public class MoveToCenterStrategy extends AbstractStrategy
}
float diffY = ObjParams.ObjectMiddleVertical() - FieldHeight / 2;
if (Math.abs(diffY) > GetStep())
if (Math.abs(diffY) >= GetStep())
{
if (diffY > 0)
MoveUp();

View File

@ -24,7 +24,7 @@ public class MoveToDownRightStrategy extends AbstractStrategy
return;
float diffX = ObjParams.RightBorder() - FieldWidth;
if (Math.abs(diffX) > GetStep())
if (Math.abs(diffX) >= GetStep())
{
if (diffX > 0)
MoveLeft();
@ -33,7 +33,7 @@ public class MoveToDownRightStrategy extends AbstractStrategy
}
float diffY = ObjParams.BottomBorder() - FieldHeight;
if (Math.abs(diffY) > GetStep())
if (Math.abs(diffY) >= GetStep())
{
if (diffY > 0)
MoveUp();