From 7a5f91114cf1a9c8518ef1f2a85a549b3fa88d7b Mon Sep 17 00:00:00 2001 From: goblinrf Date: Sat, 14 Oct 2023 19:21:50 +0300 Subject: [PATCH 01/14] Test --- .gitignore | 47 ++--- README.md | 2 +- src/AirFighterHard/DirectionType.java | 9 + src/AirFighterHard/DrawningAirFighter.java | 195 +++++++++++++++++++++ src/AirFighterHard/DrawningEngines.java | 63 +++++++ src/AirFighterHard/EntityAirFighter.java | 40 +++++ src/AirFighterHard/Main.java | 96 ++++++++++ src/AirFighterHard/NumberType.java | 7 + 8 files changed, 436 insertions(+), 23 deletions(-) create mode 100644 src/AirFighterHard/DirectionType.java create mode 100644 src/AirFighterHard/DrawningAirFighter.java create mode 100644 src/AirFighterHard/DrawningEngines.java create mode 100644 src/AirFighterHard/EntityAirFighter.java create mode 100644 src/AirFighterHard/Main.java create mode 100644 src/AirFighterHard/NumberType.java diff --git a/.gitignore b/.gitignore index 9154f4c..f68d109 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,29 @@ -# ---> Java -# Compiled class file -*.class +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ -# Log file -*.log +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ -# BlueJ files -*.ctxt +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -replay_pid* +### VS Code ### +.vscode/ +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index 2596f08..6becb4a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# PIbd_23_Kislitsa_E.D_AirFighter_Hard +# PIbd-13-Salin-O.A.-Monorail-Hard diff --git a/src/AirFighterHard/DirectionType.java b/src/AirFighterHard/DirectionType.java new file mode 100644 index 0000000..136b40a --- /dev/null +++ b/src/AirFighterHard/DirectionType.java @@ -0,0 +1,9 @@ +package AirFighterHard; + +public enum DirectionType { + Up, + Down, + Left, + Right + +} diff --git a/src/AirFighterHard/DrawningAirFighter.java b/src/AirFighterHard/DrawningAirFighter.java new file mode 100644 index 0000000..5ff77ac --- /dev/null +++ b/src/AirFighterHard/DrawningAirFighter.java @@ -0,0 +1,195 @@ +package AirFighterHard; + +import javax.swing.*; +import java.awt.*; +import java.util.Random; + +public class DrawningAirFighter { + + JPanel AirFighterPanel; + private EntityAirFighter EntityAirFighter; + private int _pictureWidth; + private int _pictureHeight; + private int _startPosX = 0; + private int _startPosY = 0; + private int _airfighterWidth = 160; + private int _airfighterHeight = 68; + private int _airfighterwingkorpusHeight = 90; + private DrawningEngines DrawningEngines; + + public EntityAirFighter EntityAirFighter(){ + return EntityAirFighter; + } + public boolean Init(int speed, double weight,Color bodyColor, int engineNumb, + int width, int height, boolean racket, boolean wing, JPanel airfighterPanel){ + if(width <= _airfighterWidth || height <= _airfighterHeight) + return false; + _startPosY=70; + _startPosX = 0; + + airfighterPanel.setSize(width, height); + AirFighterPanel = airfighterPanel; + airfighterPanel.paint(AirFighterPanel.getGraphics()); + + _pictureWidth = width; + _pictureHeight = height; + EntityAirFighter = new EntityAirFighter(); + EntityAirFighter.Init(speed, weight, bodyColor, engineNumb, racket, wing); + + DrawningEngines = new DrawningEngines(); + DrawningEngines.Init(_airfighterWidth, _airfighterHeight,_startPosX,_startPosY,airfighterPanel); + Random rand = new Random(); + DrawningEngines.ChangeEnginesNumb(rand.nextInt(1, 4)); + return true; + } + + public void SetPosition(int x, int y){ + if(EntityAirFighter == null) + return; + _startPosX = x; + _startPosY = y; + if (x + _airfighterWidth >= _pictureWidth || y + _airfighterHeight >= _pictureHeight) { + _startPosX = 0; + _startPosY = 70; + } + } + + public void MoveTransport(DirectionType direction){ + if (EntityAirFighter == null) + return; + AirFighterPanel.paint(AirFighterPanel.getGraphics()); + switch (direction) + { + case Left: + if (_startPosX - EntityAirFighter.Step() >= 0) + _startPosX -= (int) EntityAirFighter.Step(); + + break; + case Up: + if (_startPosY - EntityAirFighter.Step() - _airfighterHeight > 0) + _startPosY -= (int) EntityAirFighter.Step(); + + break; + case Right: + if (_startPosX + EntityAirFighter.Step() + _airfighterWidth < _pictureWidth) + _startPosX += (int) EntityAirFighter.Step(); + else + _startPosX = _pictureWidth - _airfighterWidth; + + break; + case Down: + if (_startPosY + EntityAirFighter.Step() + _airfighterwingkorpusHeight < _pictureHeight) + _startPosY += (int) EntityAirFighter.Step(); + + break; + } + DrawningEngines.CurX = _startPosX; + DrawningEngines.CurY = _startPosY; + } + + public void DrawAirFighter(){ + Graphics2D g2d = (Graphics2D) AirFighterPanel.getGraphics(); + if (EntityAirFighter == null) + return; + + DrawningEngines.DrawEngines(); +//тело самолёта + + + + g2d.setColor(EntityAirFighter.BodyColor()); + g2d.fillRect(_startPosX + 20,_startPosY +4,140,20); + g2d.setColor(Color.BLACK); + g2d.drawRect(_startPosX + 20,_startPosY +4,140,20); + +//Нос самолёта + int[] xPointsArrNose = {_startPosX + 20,_startPosX + 20,_startPosX-3}; + int[] yPointsArrNose = {_startPosY + 4,_startPosY + 24,_startPosY + 12}; + g2d.setColor(Color.BLACK); + g2d.fillPolygon(xPointsArrNose, yPointsArrNose, xPointsArrNose.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPointsArrNose, yPointsArrNose, xPointsArrNose.length); + +// Правое крыло + int[] xPointsArrRightWing = {_startPosX + 80,_startPosX+80,_startPosX+85,_startPosX + 100}; + int[] yPointsArrRightWing = { _startPosY + 4,_startPosY - 66,_startPosY - 66, _startPosY + 4 }; + g2d.setColor(EntityAirFighter.BodyColor()); + g2d.fillPolygon(xPointsArrRightWing, yPointsArrRightWing, xPointsArrRightWing.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPointsArrRightWing, yPointsArrRightWing, xPointsArrRightWing.length); + +// Левое крыло + int[] xPointsArrLeftWing = {_startPosX + 80,_startPosX + 100,_startPosX+85,_startPosX+80}; + int[] yPointsArrLeftWing = {_startPosY + 24,_startPosY + 24,_startPosY + 94,_startPosY + 94}; + g2d.setColor(EntityAirFighter.BodyColor()); + g2d.fillPolygon(xPointsArrLeftWing, yPointsArrLeftWing, xPointsArrLeftWing.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPointsArrLeftWing, yPointsArrLeftWing, xPointsArrLeftWing.length); + +// Правое задние крыло + int[] xPointsArrRightBackWing={_startPosX + 140,_startPosX + 160,_startPosX+160,_startPosX+140}; + int[] yPointsArrRightBackWing={ _startPosY + 4,_startPosY + 4,_startPosY - 22,_startPosY -4}; + g2d.setColor(EntityAirFighter.BodyColor()); + g2d.fillPolygon(xPointsArrRightBackWing, yPointsArrRightBackWing, xPointsArrRightBackWing.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPointsArrRightBackWing, yPointsArrRightBackWing, xPointsArrRightBackWing.length); +// Заднее левое крыло + int[] xPointsArrLeftBackWing= {_startPosX + 140,_startPosX + 160,_startPosX+160,_startPosX+140}; + int[] yPointsArrLeftBackWing= {_startPosY + 24,_startPosY + 24,_startPosY + 50,_startPosY + 32}; + g2d.setColor(EntityAirFighter.BodyColor()); + g2d.fillPolygon(xPointsArrLeftBackWing, yPointsArrLeftBackWing, xPointsArrLeftBackWing.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPointsArrLeftBackWing, yPointsArrLeftBackWing, xPointsArrLeftBackWing.length); + //Ракеты + if (EntityAirFighter.Racket()) + { + g2d.setColor(Color.GRAY); + g2d.fillRect(_startPosX + 70, _startPosY - 15, 10, 10); + g2d.setColor(Color.BLACK); + g2d.drawRect(_startPosX + 70, _startPosY - 15, 10, 10); + int[] xPointsArrNoseRacket = {_startPosX + 70,_startPosX + 70,_startPosX + 60}; + int[] yPointsArrNoseRacket = {_startPosY -5,_startPosY - 15,_startPosY -10}; + + g2d.setColor(Color.RED); + g2d.fillPolygon(xPointsArrNoseRacket, yPointsArrNoseRacket, xPointsArrNoseRacket.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPointsArrNoseRacket, yPointsArrNoseRacket, xPointsArrNoseRacket.length); + g2d.setColor(Color.GRAY); + g2d.fillRect(_startPosX + 70, _startPosY - 40, 10, 10); + g2d.setColor(Color.BLACK); + g2d.drawRect(_startPosX + 70, _startPosY - 40, 10, 10); + int[] xPoints2ArrNoseRacket = {_startPosX + 70,_startPosX + 70,_startPosX + 60}; + int[] yPoints2ArrNoseRacket = {_startPosY -30,_startPosY - 40,_startPosY -35}; + g2d.setColor(Color.RED); + g2d.fillPolygon(xPoints2ArrNoseRacket, yPoints2ArrNoseRacket, xPoints2ArrNoseRacket.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPoints2ArrNoseRacket, yPoints2ArrNoseRacket, xPoints2ArrNoseRacket.length); + + g2d.setColor(Color.GRAY); + g2d.fillRect(_startPosX + 70, _startPosY + 59, 10, 10); + g2d.setColor(Color.BLACK); + g2d.drawRect(_startPosX + 70, _startPosY + 59, 10, 10); + int[] xPoints3ArrNoseRacket ={_startPosX + 70,_startPosX + 70,_startPosX + 60}; + int[] yPoints3ArrNoseRacket ={_startPosY +59,_startPosY + 69,_startPosY + 64}; + g2d.setColor(Color.RED); + g2d.fillPolygon(xPoints3ArrNoseRacket, yPoints3ArrNoseRacket, xPoints3ArrNoseRacket.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPoints3ArrNoseRacket, yPoints3ArrNoseRacket, xPoints3ArrNoseRacket.length); + + g2d.setColor(Color.GRAY); + g2d.fillRect(_startPosX + 70, _startPosY + 34, 10, 10); + g2d.setColor(Color.BLACK); + g2d.drawRect(_startPosX + 70, _startPosY + 34, 10, 10); + int[] xPoints4ArrNoseRacket={_startPosX + 70,_startPosX + 70,_startPosX + 60}; + int[] yPoints4ArrNoseRacket={_startPosY +34,_startPosY + 44,_startPosY + 39}; + g2d.setColor(Color.RED); + g2d.fillPolygon(xPoints4ArrNoseRacket, yPoints4ArrNoseRacket, xPoints4ArrNoseRacket.length); + g2d.setColor(Color.BLACK); + g2d.drawPolygon(xPoints4ArrNoseRacket, yPoints4ArrNoseRacket, xPoints4ArrNoseRacket.length); + + } + + } + + +} diff --git a/src/AirFighterHard/DrawningEngines.java b/src/AirFighterHard/DrawningEngines.java new file mode 100644 index 0000000..d78208b --- /dev/null +++ b/src/AirFighterHard/DrawningEngines.java @@ -0,0 +1,63 @@ +package AirFighterHard; + +import javax.swing.*; +import java.awt.*; + +public class DrawningEngines { + private int WheelSz; + JPanel AirFighterPanel; + private NumberType EnginesNumb; + private Color EngineColor; + private int Width, Height; + public int CurX, CurY; + + + boolean Init(int width, int height, int curX, int curY, JPanel airfighterPanel){ + Width = width; + Height = height; + CurX = curX; + CurY = curY; + EngineColor = Color.BLACK; + AirFighterPanel = airfighterPanel; + + return true; + } + + public void ChangeEnginesNumb(int x){ + if(x ==1) + EnginesNumb = NumberType.Two; + if(x == 2) + EnginesNumb = NumberType.Four; + if(x == 3) + EnginesNumb = NumberType.Six; + } + + public NumberType WheelsNumb(){ + return EnginesNumb; + } + + public void DrawEngines(){ + Graphics2D g2d = (Graphics2D) AirFighterPanel.getGraphics(); + g2d.setColor(EngineColor); + g2d.fillOval(CurX + 92,CurY - 15,25,10 ); + g2d.fillOval(CurX + 92,CurY + 34,25,10 ); + + + + if (EnginesNumb == NumberType.Four || EnginesNumb == NumberType.Six) + { + g2d.fillOval(CurX + 86,CurY - 40,25,10 ); + + g2d.fillOval(CurX + 86,CurY +59,25,10 ); + } + + + if (EnginesNumb == NumberType.Six) + { + g2d.fillOval(CurX + 128,CurY -7,25,10 ); + g2d.fillOval(CurX + 128,CurY +25,25,10 ); + } + } + + +} diff --git a/src/AirFighterHard/EntityAirFighter.java b/src/AirFighterHard/EntityAirFighter.java new file mode 100644 index 0000000..f74a219 --- /dev/null +++ b/src/AirFighterHard/EntityAirFighter.java @@ -0,0 +1,40 @@ +package AirFighterHard; +import java.awt.*; + +public class EntityAirFighter { + private int Speed, EngineNumb; + private double Weight, Step; + private Color BodyColor; + private boolean Wing; + private boolean Racket; + + public int Speed(){ + return Speed; + } + + public int WheelNumb(){ + return EngineNumb; + } + public double Weight(){ + return Weight; + } + public double Step(){ + return Step; + } + public Color BodyColor(){ + return BodyColor; + } + public boolean Racket(){return Racket;} + public boolean Wing(){return Wing;} + public void Init(int speed, double weight, Color bodyColor, int engineNumb, + boolean racket, boolean wing){ + Speed = speed; + Weight = weight; + Step = (double)Speed * 100 / Weight; + BodyColor = bodyColor; + + EngineNumb = engineNumb; + Racket = racket; + Wing = wing; + } +} diff --git a/src/AirFighterHard/Main.java b/src/AirFighterHard/Main.java new file mode 100644 index 0000000..d60ae2e --- /dev/null +++ b/src/AirFighterHard/Main.java @@ -0,0 +1,96 @@ +package AirFighterHard; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.Random; +import javax.imageio.ImageIO; +import javax.swing.*; + +public class Main { + public static void main(String[] args) throws IOException { + JFrame AirFighterFrame = new JFrame(); + JPanel AirFighterPanel = new JPanel(); + AirFighterFrame.setLayout(new BorderLayout()); + AirFighterFrame.setSize(900, 500); + AirFighterFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + AirFighterFrame.setLayout(new BorderLayout(1,1)); + DrawningAirFighter DrawningAirFighter = new DrawningAirFighter(); + AirFighterPanel.setLayout(null); + + BufferedImage RightIcon = ImageIO.read(new File("RightButton.png")); + BufferedImage LeftIcon = ImageIO.read(new File("LeftButton.png")); + BufferedImage UpIcon = ImageIO.read(new File("UpButton.png")); + BufferedImage DownIcon = ImageIO.read(new File("DownButton.png")); + + JButton RightButton = new JButton(new ImageIcon(RightIcon)); + JButton LeftButton = new JButton(new ImageIcon(LeftIcon)); + JButton UpButton = new JButton(new ImageIcon(UpIcon)); + JButton DownButton = new JButton(new ImageIcon(DownIcon)); + + JButton CreateButton = new JButton(); + CreateButton.setText("Создать"); + CreateButton.setBounds(12, 401, 90, 40); + RightButton.setBounds(840,411,30,30); + LeftButton.setBounds(768,411,30,30); + UpButton.setBounds(804,375,30,30); + DownButton.setBounds(804,411,30,30); + AirFighterPanel.add(CreateButton); + AirFighterPanel.add(RightButton); + AirFighterPanel.add(LeftButton); + AirFighterPanel.add(UpButton); + AirFighterPanel.add(DownButton); + AirFighterFrame.add(AirFighterPanel, BorderLayout.CENTER); + Random random = new Random(); + CreateButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + DrawningAirFighter.Init(random.nextInt(100, 300), random.nextDouble(1000, 3000), + Color.getHSBColor(random.nextInt(0, 301), random.nextInt(0, 301), random.nextInt(0, 301)), + random.nextInt(1, 4), + AirFighterPanel.getWidth(), AirFighterPanel.getHeight(), random.nextBoolean(), random.nextBoolean(), AirFighterPanel); + DrawningAirFighter.DrawAirFighter(); + } + }); + RightButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(DrawningAirFighter.EntityAirFighter() == null) + return; + DrawningAirFighter.MoveTransport(DirectionType.Right); + DrawningAirFighter.DrawAirFighter(); + } + }); + LeftButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(DrawningAirFighter.EntityAirFighter() == null) + return; + DrawningAirFighter.MoveTransport(DirectionType.Left); + DrawningAirFighter.DrawAirFighter(); + } + }); + UpButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(DrawningAirFighter.EntityAirFighter() == null) + return; + DrawningAirFighter.MoveTransport(DirectionType.Up); + DrawningAirFighter.DrawAirFighter(); + } + }); + DownButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(DrawningAirFighter.EntityAirFighter() == null) + return; + DrawningAirFighter.MoveTransport(DirectionType.Down); + DrawningAirFighter.DrawAirFighter(); + } + }); + + AirFighterFrame.setVisible(true); + } +} diff --git a/src/AirFighterHard/NumberType.java b/src/AirFighterHard/NumberType.java new file mode 100644 index 0000000..ebba054 --- /dev/null +++ b/src/AirFighterHard/NumberType.java @@ -0,0 +1,7 @@ +package AirFighterHard; + +public enum NumberType { + Two, + Four, + Six +} -- 2.25.1 From 9648850f1d0cedb7f858f87edf915590a1461a2c Mon Sep 17 00:00:00 2001 From: goblinrf Date: Sat, 14 Oct 2023 19:23:10 +0300 Subject: [PATCH 02/14] Test --- .idea/misc.xml | 6 +++ .idea/modules.xml | 8 +++ .idea/uiDesigner.xml | 124 +++++++++++++++++++++++++++++++++++++++++++ .idea/vcs.xml | 6 +++ 4 files changed, 144 insertions(+) create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..432b646 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..598c828 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file -- 2.25.1 From 66361945844622542fadcf87cc4794c65eaa64c8 Mon Sep 17 00:00:00 2001 From: Egor2003 Date: Sat, 14 Oct 2023 19:39:58 +0400 Subject: [PATCH 03/14] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'.idea/misc.xml'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/misc.xml diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 432b646..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file -- 2.25.1 From e839721bae18b42f5d70060eecd0bf6a86091338 Mon Sep 17 00:00:00 2001 From: Egor2003 Date: Sat, 14 Oct 2023 19:40:06 +0400 Subject: [PATCH 04/14] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'.idea/modules.xml'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/modules.xml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/modules.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 598c828..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file -- 2.25.1 From cb0819b00840d7f939fd0127edebf2880e8a324f Mon Sep 17 00:00:00 2001 From: Egor2003 Date: Sat, 14 Oct 2023 19:40:10 +0400 Subject: [PATCH 05/14] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'.idea/uiDesigner.xml'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/uiDesigner.xml | 124 ------------------------------------------- 1 file changed, 124 deletions(-) delete mode 100644 .idea/uiDesigner.xml diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index 2b63946..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- 2.25.1 From 576f76a8418a1a6ad738101c1e28744ecbc561c5 Mon Sep 17 00:00:00 2001 From: Egor2003 Date: Sat, 14 Oct 2023 19:40:14 +0400 Subject: [PATCH 06/14] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'.idea/vcs.xml'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/vcs.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file -- 2.25.1 From 3e1f894eb1345f71683cb98d3a2bcfad84a98e7e Mon Sep 17 00:00:00 2001 From: Egor2003 Date: Sat, 14 Oct 2023 19:52:39 +0400 Subject: [PATCH 07/14] revert 576f76a8418a1a6ad738101c1e28744ecbc561c5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit revert Удалить '.idea/vcs.xml' --- .idea/vcs.xml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file -- 2.25.1 From 7640caf855ab52f89d7f93e659b38e886a52d327 Mon Sep 17 00:00:00 2001 From: Egor2003 Date: Sat, 14 Oct 2023 20:05:21 +0400 Subject: [PATCH 08/14] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'.idea/vcs.xml'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/vcs.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file -- 2.25.1 From ccfa42bf48a3a6286b647d1b3a314fcac82c517c Mon Sep 17 00:00:00 2001 From: goblinrf Date: Sat, 14 Oct 2023 20:06:08 +0300 Subject: [PATCH 09/14] Done --- .idea/.gitignore | 3 +++ src/AirFighterHard/DrawningAirFighter.java | 2 +- src/AirFighterHard/DrawningEngines.java | 10 ++++------ 3 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/AirFighterHard/DrawningAirFighter.java b/src/AirFighterHard/DrawningAirFighter.java index 5ff77ac..a5267de 100644 --- a/src/AirFighterHard/DrawningAirFighter.java +++ b/src/AirFighterHard/DrawningAirFighter.java @@ -37,7 +37,7 @@ public class DrawningAirFighter { EntityAirFighter.Init(speed, weight, bodyColor, engineNumb, racket, wing); DrawningEngines = new DrawningEngines(); - DrawningEngines.Init(_airfighterWidth, _airfighterHeight,_startPosX,_startPosY,airfighterPanel); + DrawningEngines.Init(_startPosX,_startPosY,airfighterPanel); Random rand = new Random(); DrawningEngines.ChangeEnginesNumb(rand.nextInt(1, 4)); return true; diff --git a/src/AirFighterHard/DrawningEngines.java b/src/AirFighterHard/DrawningEngines.java index d78208b..e077857 100644 --- a/src/AirFighterHard/DrawningEngines.java +++ b/src/AirFighterHard/DrawningEngines.java @@ -8,13 +8,11 @@ public class DrawningEngines { JPanel AirFighterPanel; private NumberType EnginesNumb; private Color EngineColor; - private int Width, Height; public int CurX, CurY; - boolean Init(int width, int height, int curX, int curY, JPanel airfighterPanel){ - Width = width; - Height = height; + boolean Init( int curX, int curY, JPanel airfighterPanel){ + CurX = curX; CurY = curY; EngineColor = Color.BLACK; @@ -24,11 +22,11 @@ public class DrawningEngines { } public void ChangeEnginesNumb(int x){ - if(x ==1) + if(x <= 1) EnginesNumb = NumberType.Two; if(x == 2) EnginesNumb = NumberType.Four; - if(x == 3) + if(x >= 3) EnginesNumb = NumberType.Six; } -- 2.25.1 From fad7731fa2db1675a1b22d41fbb3169c47af08ce Mon Sep 17 00:00:00 2001 From: goblinrf Date: Sat, 14 Oct 2023 20:09:23 +0300 Subject: [PATCH 10/14] Done --- src/AirFighterHard/DrawningEngines.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/AirFighterHard/DrawningEngines.java b/src/AirFighterHard/DrawningEngines.java index e077857..5e9adcf 100644 --- a/src/AirFighterHard/DrawningEngines.java +++ b/src/AirFighterHard/DrawningEngines.java @@ -4,13 +4,10 @@ import javax.swing.*; import java.awt.*; public class DrawningEngines { - private int WheelSz; JPanel AirFighterPanel; private NumberType EnginesNumb; private Color EngineColor; public int CurX, CurY; - - boolean Init( int curX, int curY, JPanel airfighterPanel){ CurX = curX; @@ -20,7 +17,6 @@ public class DrawningEngines { return true; } - public void ChangeEnginesNumb(int x){ if(x <= 1) EnginesNumb = NumberType.Two; @@ -29,19 +25,15 @@ public class DrawningEngines { if(x >= 3) EnginesNumb = NumberType.Six; } - public NumberType WheelsNumb(){ return EnginesNumb; } - public void DrawEngines(){ Graphics2D g2d = (Graphics2D) AirFighterPanel.getGraphics(); g2d.setColor(EngineColor); g2d.fillOval(CurX + 92,CurY - 15,25,10 ); g2d.fillOval(CurX + 92,CurY + 34,25,10 ); - - if (EnginesNumb == NumberType.Four || EnginesNumb == NumberType.Six) { g2d.fillOval(CurX + 86,CurY - 40,25,10 ); @@ -49,13 +41,10 @@ public class DrawningEngines { g2d.fillOval(CurX + 86,CurY +59,25,10 ); } - if (EnginesNumb == NumberType.Six) { g2d.fillOval(CurX + 128,CurY -7,25,10 ); g2d.fillOval(CurX + 128,CurY +25,25,10 ); } } - - } -- 2.25.1 From 101e7291a02a703c357d6ae5903338631e171562 Mon Sep 17 00:00:00 2001 From: Egor2003 Date: Sun, 15 Oct 2023 10:24:11 +0400 Subject: [PATCH 11/14] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D0=BD=D0=B0=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6becb4a..2596f08 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# PIbd-13-Salin-O.A.-Monorail-Hard +# PIbd_23_Kislitsa_E.D_AirFighter_Hard -- 2.25.1 From 8d447ae26d592ed9e91e3e77c4faf0d0777ce553 Mon Sep 17 00:00:00 2001 From: goblinrf Date: Mon, 16 Oct 2023 21:33:42 +0300 Subject: [PATCH 12/14] Done --- src/AirFighterHard/DrawningAirFighter.java | 8 +------- src/AirFighterHard/EntityAirFighter.java | 2 -- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/AirFighterHard/DrawningAirFighter.java b/src/AirFighterHard/DrawningAirFighter.java index a5267de..8dcfa4d 100644 --- a/src/AirFighterHard/DrawningAirFighter.java +++ b/src/AirFighterHard/DrawningAirFighter.java @@ -39,7 +39,7 @@ public class DrawningAirFighter { DrawningEngines = new DrawningEngines(); DrawningEngines.Init(_startPosX,_startPosY,airfighterPanel); Random rand = new Random(); - DrawningEngines.ChangeEnginesNumb(rand.nextInt(1, 4)); + DrawningEngines.ChangeEnginesNumb(engineNumb); return true; } @@ -80,7 +80,6 @@ public class DrawningAirFighter { case Down: if (_startPosY + EntityAirFighter.Step() + _airfighterwingkorpusHeight < _pictureHeight) _startPosY += (int) EntityAirFighter.Step(); - break; } DrawningEngines.CurX = _startPosX; @@ -91,17 +90,12 @@ public class DrawningAirFighter { Graphics2D g2d = (Graphics2D) AirFighterPanel.getGraphics(); if (EntityAirFighter == null) return; - DrawningEngines.DrawEngines(); //тело самолёта - - - g2d.setColor(EntityAirFighter.BodyColor()); g2d.fillRect(_startPosX + 20,_startPosY +4,140,20); g2d.setColor(Color.BLACK); g2d.drawRect(_startPosX + 20,_startPosY +4,140,20); - //Нос самолёта int[] xPointsArrNose = {_startPosX + 20,_startPosX + 20,_startPosX-3}; int[] yPointsArrNose = {_startPosY + 4,_startPosY + 24,_startPosY + 12}; diff --git a/src/AirFighterHard/EntityAirFighter.java b/src/AirFighterHard/EntityAirFighter.java index f74a219..bc7f82a 100644 --- a/src/AirFighterHard/EntityAirFighter.java +++ b/src/AirFighterHard/EntityAirFighter.java @@ -11,7 +11,6 @@ public class EntityAirFighter { public int Speed(){ return Speed; } - public int WheelNumb(){ return EngineNumb; } @@ -32,7 +31,6 @@ public class EntityAirFighter { Weight = weight; Step = (double)Speed * 100 / Weight; BodyColor = bodyColor; - EngineNumb = engineNumb; Racket = racket; Wing = wing; -- 2.25.1 From 4918afa089b21288260cf2e836b861d9cde10ae7 Mon Sep 17 00:00:00 2001 From: goblinrf Date: Mon, 16 Oct 2023 21:37:09 +0300 Subject: [PATCH 13/14] Done --- src/AirFighterHard/EntityAirFighter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AirFighterHard/EntityAirFighter.java b/src/AirFighterHard/EntityAirFighter.java index bc7f82a..8743420 100644 --- a/src/AirFighterHard/EntityAirFighter.java +++ b/src/AirFighterHard/EntityAirFighter.java @@ -11,7 +11,7 @@ public class EntityAirFighter { public int Speed(){ return Speed; } - public int WheelNumb(){ + public int EngineNumb(){ return EngineNumb; } public double Weight(){ -- 2.25.1 From c960ca3f0d48f61e294b5e09a40386acc953a7a0 Mon Sep 17 00:00:00 2001 From: Egor2003 Date: Tue, 17 Oct 2023 11:58:28 +0400 Subject: [PATCH 14/14] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'.idea/.gitignore'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -- 2.25.1