diff --git a/ProjectAirFighter/.idea/uiDesigner.xml b/ProjectAirFighter/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/ProjectAirFighter/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/ProjectAirFighter/src/DirectionType.java b/ProjectAirFighter/src/DirectionType.java
new file mode 100644
index 0000000..def3f02
--- /dev/null
+++ b/ProjectAirFighter/src/DirectionType.java
@@ -0,0 +1,21 @@
+/**
+ * Направление перемещение
+ */
+public enum DirectionType {
+ /**
+ * Вверх
+ */
+ Up,
+ /**
+ * Вниз
+ */
+ Down,
+ /**
+ * Влево
+ */
+ Left,
+ /**
+ * Вправо
+ */
+ Right,
+}
diff --git a/ProjectAirFighter/src/DrawningAirFighter.java b/ProjectAirFighter/src/DrawningAirFighter.java
new file mode 100644
index 0000000..cf986ed
--- /dev/null
+++ b/ProjectAirFighter/src/DrawningAirFighter.java
@@ -0,0 +1,247 @@
+import java.awt.*;
+import java.util.Random;
+
+/**
+ * Класс отрисовки и перемещения объекта-сущности
+ */
+public class DrawningAirFighter {
+ /**
+ * Класс-сущность
+ */
+
+ public EntityAirFighter EntityAirFighter;
+ public EntityAirFighter getEntityAirFighter(){
+ return EntityAirFighter;
+ }
+
+ /**
+ * Обхект класса отрисовки иллюминаторов
+ */
+ private DrawningAirFighterEngine _drawningAirFighterEngine;
+ /**
+ * Ширина окна
+ */
+ private Integer _pictureWidth;
+ /**
+ * Высота окна
+ */
+ private Integer _pictureHeight;
+
+ /**
+ * Начальная координата x
+ */
+ private Integer _startPosX;
+
+ /**
+ * Начальная координата y
+ */
+ private Integer _startPosY;
+
+ /**
+ * Ширина истребителя
+ */
+ public final int _drawningAirFlighterWidth = 120;
+
+ /**
+ * Высота истребителя
+ */
+ public final int _drawningAirFlighterHeight = 140;
+
+ /**
+ * Инициализация свойств
+ * @param speed Скорость
+ * @param weight Вес
+ * @param bodyColor Основной цвет
+ * @param additionalColor Дополнительный цвет
+ * @param rocket Признак (опция) наличия ракет
+ * @param additionalWing Признак (опция) наличия дополнительный крыльев
+ */
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, boolean rocket, boolean additionalWing){
+ EntityAirFighter = new EntityAirFighter();
+ EntityAirFighter.Init(speed,weight,bodyColor,additionalColor,rocket,additionalWing);
+ _pictureWidth = null;
+ _pictureHeight = null;
+ _startPosX = null;
+ _startPosY = null;
+
+ _drawningAirFighterEngine = new DrawningAirFighterEngine();
+ Random random = new Random();
+ int engineCount = 2 * random.nextInt(1,3);
+ _drawningAirFighterEngine.setEngineCount(engineCount);
+ }
+
+ /**
+ * Установка границ поля
+ * @param width Ширина поля
+ * @param height Высота поля
+ * @return
+ */
+ public boolean SetPictureSize(int width, int height){
+ if (width > _drawningAirFlighterWidth && height > _drawningAirFlighterHeight){
+ _pictureWidth = width;
+ _pictureHeight = height;
+
+ if (_startPosX != null && _startPosY != null){
+ if(_startPosX + _drawningAirFlighterWidth > _pictureWidth){
+ _startPosX = _pictureWidth - _drawningAirFlighterWidth;
+ }
+ if(_startPosY + _drawningAirFlighterHeight > _pictureHeight){
+ _startPosY = _pictureHeight - _drawningAirFlighterHeight;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Установка позиции истребителя
+ * @param x Координата x
+ * @param y Координата y
+ */
+ public void SetPosition(int x, int y){
+ if(_pictureHeight == null || _pictureWidth == null){
+ return;
+ }
+ else {
+ _startPosX = x;
+ _startPosY = y;
+
+ if(_startPosX < 0) _startPosX = 0;
+ if(_startPosY < 0) _startPosY = 0;
+
+ if(_startPosX + _drawningAirFlighterWidth > _pictureWidth){
+ _startPosX = _pictureWidth - _drawningAirFlighterWidth;
+ }
+ if(_startPosY + _drawningAirFlighterHeight > _pictureHeight){
+ _startPosY = _pictureHeight - _drawningAirFlighterHeight;
+ }
+ }
+ }
+
+ /**
+ * Выбор направления перемещения
+ *
+ * @param direction Направление
+ * @return true - перемещение возможно и выполнено, false - перемещение невозможно и не выполено
+ */
+ public boolean MoveTransport(DirectionType direction){
+ if(EntityAirFighter == null || _startPosX == null || _startPosY == null){
+ return false;
+ }
+
+ switch (direction){
+ case DirectionType.Up:
+ if(_startPosY - EntityAirFighter.getStep() > 0){
+ _startPosY -= (int)EntityAirFighter.getStep();
+ }
+ return true;
+ case DirectionType.Left:
+ if(_startPosX - EntityAirFighter.getStep() > 0){
+ _startPosX -= (int)EntityAirFighter.getStep();
+ }
+ return true;
+ case DirectionType.Down:
+ if(_startPosY + EntityAirFighter.getStep() < _pictureWidth - _drawningAirFlighterHeight){
+ _startPosY -= (int)EntityAirFighter.getStep();
+ }
+ return true;
+ case DirectionType.Right:
+ if (_startPosX + EntityAirFighter.getStep() > _pictureHeight - _drawningAirFlighterWidth){
+ _startPosX -=(int)EntityAirFighter.getStep();
+ }
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public void DrawTransport(Graphics g){
+ if(EntityAirFighter == null || _startPosX == null || _startPosY == null){
+ return;
+ }
+
+ Graphics2D g2d = (Graphics2D) g;
+
+ //ракеты
+ if (EntityAirFighter.withRocket()){
+
+ int[] xFirstRocket = {_startPosX + 55, _startPosX + 95, _startPosX + 105, _startPosX + 95,_startPosX + 55};
+ int[] yFirstRocket = {_startPosY + 110,_startPosY + 110,_startPosY + 115, _startPosY + 120,_startPosY + 120};
+ g2d.setColor(Color.BLACK);
+ g2d.drawPolygon(xFirstRocket,yFirstRocket, 5);
+
+ g2d.setColor(EntityAirFighter.getAdditionalColor());
+ g2d.fillPolygon(xFirstRocket,yFirstRocket, 5);
+
+ int[] xSecondRocket = {_startPosX + 55, _startPosX + 95, _startPosX + 105, _startPosX + 95,_startPosX + 55};
+ int[] ySecondRocket = {_startPosY + 30,_startPosY + 30,_startPosY + 35, _startPosY + 40,_startPosY + 40};
+ g2d.setColor(Color.BLACK);
+ g2d.drawPolygon(xSecondRocket,ySecondRocket, 5);
+ }
+
+ //корпус
+ g2d.setColor(Color.BLACK);
+ g2d.drawRect(_startPosX, _startPosY + 60, 100,20);
+ int[] xBody = {_startPosX + 100, _startPosX + 120, _startPosX + 100};
+ int[] yBody = {_startPosY + 80, _startPosY + 70, _startPosY + 60};
+ g2d.drawPolygon(xBody,yBody, 3);
+ g2d.setColor(EntityAirFighter.getBodyColor());
+ g2d.fillPolygon(xBody,yBody, 3);
+
+ //верхнее крыло
+ g2d.setColor(Color.BLACK);
+ int[] xWingUpper = {_startPosX + 80, _startPosX + 80, _startPosX + 70, _startPosX + 60};
+ int[] yWingUpper = {_startPosY + 80, _startPosY + 140, _startPosY + 140, _startPosY + 80};
+ g2d.drawPolygon(xWingUpper, yWingUpper, 4);
+ g2d.setColor(EntityAirFighter.getBodyColor());
+ g2d.fillPolygon(xWingUpper, yWingUpper, 4);
+
+ //нижнее крыло
+ g2d.setColor(Color.BLACK);
+ int[] xWingLower = {_startPosX + 80, _startPosX + 80, _startPosX + 70, _startPosX + 60};
+ int[] yWingLower = {_startPosY + 60, _startPosY, _startPosY, _startPosY + 60};
+ g2d.drawPolygon(xWingLower, yWingLower, 4);
+ g2d.setColor(EntityAirFighter.getBodyColor());
+ g2d.fillPolygon(xWingLower, yWingLower, 4);
+
+ //задние крылья
+
+ //верхнее
+ g2d.setColor(Color.BLACK);
+ int[] xRearWingUpper = {_startPosX, _startPosX, _startPosX + 25, _startPosX + 25};
+ int[] yRearWingUpper = {_startPosY + 60, _startPosY + 30, _startPosY + 50, _startPosY + 60};
+ g2d.drawPolygon(xRearWingUpper, yRearWingUpper, 4);
+ g2d.setColor(EntityAirFighter.getBodyColor());
+ g2d.fillPolygon(xRearWingUpper, yRearWingUpper, 4);
+ //нижнее
+ g2d.setColor(Color.BLACK);
+ int[] xRearWingLower = {_startPosX, _startPosX, _startPosX + 25, _startPosX + 25};
+ int[] yRearWingLower = {_startPosY + 80, _startPosY + 110, _startPosY + 90, _startPosY + 80};
+ g2d.drawPolygon(xRearWingLower, yRearWingLower, 4);
+ g2d.setColor(EntityAirFighter.getBodyColor());
+ g2d.fillPolygon(xRearWingLower, yRearWingLower, 4);
+
+
+ if(EntityAirFighter.withAdditionalWing()){
+ // нижнее доп крыло
+ g2d.setColor(Color.BLACK);
+ int[] xAddWingLower = {_startPosX + 60, _startPosX + 60, _startPosX + 50, _startPosX + 40};
+ int[] yAddWingLower = {_startPosY + 80, _startPosY + 140, _startPosY + 140, _startPosY + 80};
+ g2d.drawPolygon(xAddWingLower, yAddWingLower, 4);
+ g2d.setColor(EntityAirFighter.getAdditionalColor());
+ g2d.fillPolygon(xAddWingLower, yAddWingLower, 4);
+
+ // верхнее доп крыло
+ g2d.setColor(Color.BLACK);
+ int[] xAddWingUpper = {_startPosX + 60, _startPosX + 60, _startPosX + 50, _startPosX + 40};
+ int[] yAddWingUpper = {_startPosY + 60, _startPosY, _startPosY, _startPosY + 60};
+ g2d.drawPolygon(xAddWingUpper , yAddWingUpper , 4);
+ g2d.setColor(EntityAirFighter.getAdditionalColor());
+ g2d.fillPolygon(xAddWingUpper , yAddWingUpper, 4);
+ }
+ }
+
+
+
+}
diff --git a/ProjectAirFighter/src/DrawningAirFighterEngine.java b/ProjectAirFighter/src/DrawningAirFighterEngine.java
new file mode 100644
index 0000000..eeab7e1
--- /dev/null
+++ b/ProjectAirFighter/src/DrawningAirFighterEngine.java
@@ -0,0 +1,35 @@
+import java.awt.*;
+
+/**
+ * Класс отрисовки иллюминаторов
+ */
+public class DrawningAirFighterEngine {
+
+ /**
+ * количество двигателей
+ */
+ private EngineEnum _engineCount;
+
+ public void setEngineCount(int engineCount){
+ for(EngineEnum value : EngineEnum.values()){
+ if(value.engineEnumNumber == engineCount){
+ _engineCount = value;
+ return;
+ }
+ }
+ }
+ private void DrawEngine(Graphics2D g2d, int posX, int posY){
+ g2d.setColor(Color.BLACK);
+ g2d.drawOval(posX,posY,10,10);
+ }
+ public void drawAirFighterEngine(Graphics g, float startPosX, float startPosY){
+ Graphics2D g2d = (Graphics2D) g;
+ int intervalBetweenEngine = 140 / _engineCount.getEngineEnumNumber();
+ for(int i = 0; i < _engineCount.getEngineEnumNumber(); i++){
+ int posX = (int) (startPosX + i * intervalBetweenEngine);
+ DrawEngine(g2d, posX, (int)startPosY);
+ }
+ }
+
+
+}
diff --git a/ProjectAirFighter/src/EngineEnum.java b/ProjectAirFighter/src/EngineEnum.java
new file mode 100644
index 0000000..4e1b224
--- /dev/null
+++ b/ProjectAirFighter/src/EngineEnum.java
@@ -0,0 +1,26 @@
+/**
+ * Перечисление возможного колличества двигателей
+ */
+public enum EngineEnum {
+ /**
+ * Два
+ */
+ Two(2),
+ /**
+ * Четыре
+ */
+ Four(4),
+ /**
+ * Шесть
+ */
+ Six(6);
+
+ public final int engineEnumNumber;
+ public int getEngineEnumNumber(){
+ return engineEnumNumber;
+ }
+
+ EngineEnum(int number){
+ this.engineEnumNumber = number;
+ }
+}
diff --git a/ProjectAirFighter/src/EntityAirFighter.java b/ProjectAirFighter/src/EntityAirFighter.java
new file mode 100644
index 0000000..184b9c7
--- /dev/null
+++ b/ProjectAirFighter/src/EntityAirFighter.java
@@ -0,0 +1,77 @@
+import java.awt.*;
+/**
+ * Класс сущности "Истребитель"
+ */
+public class EntityAirFighter {
+
+ /**
+ * Скорость
+ */
+ public int Speed;
+
+ /**
+ * Вес
+ */
+ public double Weight;
+
+ /**
+ * Основной цвет
+ */
+ public Color BodyColor;
+
+ public Color getBodyColor() {
+ return BodyColor;
+ }
+
+ /**
+ * Дополнительный цвет
+ */
+ public Color AdditionalColor;
+ public Color getAdditionalColor() {
+ return AdditionalColor;
+ }
+
+ /**
+ * Признак (опция) наличия ракет
+ */
+ public boolean Rocket;
+ public boolean withRocket(){
+ return Rocket;
+ }
+
+ /**
+ * Признак (опция) наличия дополнительных крыльев
+ */
+ public boolean AdditionalWing;
+ public boolean withAdditionalWing(){
+ return AdditionalWing;
+ }
+
+ /**
+ * Шаг
+ */
+ public double Step;
+ public double getStep(){
+ return (double) Speed * 100 / Weight;
+ }
+
+ /**
+ * Инициализация полей объекта-класса истребителя
+ *
+ * @param speed скорость
+ * @param weight вес
+ * @param bodyColor основной цвет
+ * @param additionalColor дополнительный цвет
+ * @param rocket признак (опция) наличия ракет
+ * @param additionalWing Признак (опция) наличия дополнительный крыльев
+ */
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, boolean rocket, boolean additionalWing){
+
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ Rocket = rocket;
+ AdditionalWing = additionalWing;
+ }
+}
diff --git a/ProjectAirFighter/src/FormAirFighter.form b/ProjectAirFighter/src/FormAirFighter.form
new file mode 100644
index 0000000..3e291fd
--- /dev/null
+++ b/ProjectAirFighter/src/FormAirFighter.form
@@ -0,0 +1,94 @@
+
+
diff --git a/ProjectAirFighter/src/FormAirFighter.java b/ProjectAirFighter/src/FormAirFighter.java
new file mode 100644
index 0000000..6bbd2a4
--- /dev/null
+++ b/ProjectAirFighter/src/FormAirFighter.java
@@ -0,0 +1,138 @@
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Форма, работающая с объектом "истребитель"
+ */
+public class FormAirFighter {
+
+ /**
+ * Поле-объект для отрисовки объекта
+ */
+ private DrawningAirFighter _drawningAirFighter;
+
+ private JPanel PanelWrapper;
+
+
+ public JPanel getPanelWrapper() {
+ return PanelWrapper;
+ }
+ private JPanel PictureBox;
+
+ private JButton buttonCreate;
+
+ private JButton buttonUp;
+
+ private JButton buttonLeft;
+
+ private JButton buttonRight;
+
+ private JButton buttonDown;
+
+ private List controls;
+
+ /**
+ * Конструктор формы
+ */
+ public FormAirFighter(){
+ buttonUp.setName("up");
+ buttonLeft.setName("left");
+ buttonRight.setName("right");
+ buttonDown.setName("down");
+
+ InitializeControlsRepaintList();
+
+ buttonCreate.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ _drawningAirFighter = new DrawningAirFighter();
+ Random random = new Random();
+
+ _drawningAirFighter.Init(random.nextInt(100,300), random.nextDouble(1000,3000), new Color(random.nextInt(256),
+ random.nextInt(256),random.nextInt(256)),
+ new Color(random.nextInt(256),random.nextInt(256),random.nextInt(256)),random.nextBoolean(), random.nextBoolean());
+ _drawningAirFighter.SetPictureSize(PictureBox.getWidth(), PictureBox.getHeight());
+ _drawningAirFighter.SetPosition(random.nextInt(10,100),random.nextInt(10,100));
+ }
+
+ });
+ ActionListener buttonMoveClickedListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String buttonName = ((JButton) e.getSource()).getName();
+ boolean result = false;
+
+ switch (buttonName) {
+ case "buttonUp":
+ result = _drawningAirFighter.MoveTransport(DirectionType.Up);
+ break;
+ case "buttonDown":
+ result = _drawningAirFighter.MoveTransport(DirectionType.Down);
+ break;
+ case "buttonLeft":
+ result = _drawningAirFighter.MoveTransport(DirectionType.Left);
+ break;
+ case "buttonRight":
+ result = _drawningAirFighter.MoveTransport(DirectionType.Right);
+ break;
+ }
+
+ if (result)
+ Draw();
+ }
+ };
+
+ buttonRight.addActionListener(buttonMoveClickedListener);
+ buttonDown.addActionListener(buttonMoveClickedListener);
+ buttonLeft.addActionListener(buttonMoveClickedListener);
+ buttonUp.addActionListener(buttonMoveClickedListener);
+
+ }
+
+ /**
+ * Метод прорисовки аэробуса
+ */
+ private void Draw() {
+ if (_drawningAirFighter.getEntityAirFighter() == null) {
+ return;
+ }
+
+ Graphics g = PictureBox.getGraphics();
+ g.setColor(PictureBox.getBackground());
+ g.fillRect(0, 0, PictureBox.getWidth(), PictureBox.getHeight());
+ _drawningAirFighter.DrawTransport(g);
+
+ RepaintControls();
+ }
+
+ /**
+ * Перерисовка кнопок
+ */
+ private void RepaintControls() {
+ for (JComponent control : controls) {
+ control.repaint();
+ }
+ }
+ /**
+ * Обновление списка кнопок
+ */
+ private void InitializeControlsRepaintList() {
+ controls = new LinkedList<>();
+ controls.add(buttonCreate);
+ controls.add(buttonUp);
+ controls.add(buttonLeft);
+ controls.add(buttonRight);
+ controls.add(buttonDown);
+ }
+
+
+}
+
+
+
+
diff --git a/ProjectAirFighter/src/Resources/down.jpg b/ProjectAirFighter/src/Resources/down.jpg
new file mode 100644
index 0000000..8c15550
Binary files /dev/null and b/ProjectAirFighter/src/Resources/down.jpg differ
diff --git a/ProjectAirFighter/src/Resources/left.jpg b/ProjectAirFighter/src/Resources/left.jpg
new file mode 100644
index 0000000..7adb422
Binary files /dev/null and b/ProjectAirFighter/src/Resources/left.jpg differ
diff --git a/ProjectAirFighter/src/Resources/right.jpg b/ProjectAirFighter/src/Resources/right.jpg
new file mode 100644
index 0000000..6c32136
Binary files /dev/null and b/ProjectAirFighter/src/Resources/right.jpg differ
diff --git a/ProjectAirFighter/src/Resources/up.jpg b/ProjectAirFighter/src/Resources/up.jpg
new file mode 100644
index 0000000..f2450fd
Binary files /dev/null and b/ProjectAirFighter/src/Resources/up.jpg differ