fix strategies
This commit is contained in:
parent
3c3fe9a53f
commit
c5a1a44785
@ -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));
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user