From 767f265a610f77bb31522557a69a8307131cf176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=91=D0=B5=D0=BB?= =?UTF-8?q?=D1=8F=D0=BD=D0=B8=D0=BD?= Date: Thu, 30 Nov 2023 20:45:01 +0400 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BE=D1=82=D0=BE=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tank/src/DrawingWheelsCombination.java | 34 +++++++++++++++----------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Tank/src/DrawingWheelsCombination.java b/Tank/src/DrawingWheelsCombination.java index f0737df..0673bc0 100644 --- a/Tank/src/DrawingWheelsCombination.java +++ b/Tank/src/DrawingWheelsCombination.java @@ -36,6 +36,12 @@ public class DrawingWheelsCombination implements IOrnamentForm { g.fillPolygon(xPontsStar, yPontsStar, xPontsStar.length); } + public void DrawSuspension(Graphics g, int _startPosX, int _startPosY) { + CombinationColor = Color.BLUE; + g.setColor(CombinationColor); + g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); + } + public void DrawWheels(Graphics g, int _startPosX, int _startPosY) { g.setColor(Color.BLACK); g.fillOval(10 + _startPosX, 42 + _startPosY, 20, 20); @@ -43,15 +49,15 @@ public class DrawingWheelsCombination implements IOrnamentForm { public void Draw(Graphics g, int _startPosX, int _startPosY) { DrawWheels(g,_startPosX, _startPosY); - g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); + DrawSuspension(g, _startPosX, _startPosY); CaterpillarStar(g,_startPosX + 5, _startPosY + 12); if (wheels == CountWheels.Two){ DrawWheels(g,_startPosX, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY); - g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 101, _startPosY + 50, 10, 3); + DrawSuspension(g, _startPosX, _startPosY); + DrawSuspension(g,_startPosX + 73, _startPosY); CaterpillarStar(g,_startPosX + 5, _startPosY + 12); CaterpillarStar(g,_startPosX + 105, _startPosY + 12); @@ -62,9 +68,9 @@ public class DrawingWheelsCombination implements IOrnamentForm { DrawWheels(g,_startPosX + 50, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY); - g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 100, _startPosY + 50, 10, 3); + DrawSuspension(g, _startPosX, _startPosY); + DrawSuspension(g,_startPosX + 24, _startPosY); + DrawSuspension(g,_startPosX + 73, _startPosY); CaterpillarStar(g,_startPosX + 5, _startPosY + 12); @@ -78,10 +84,10 @@ public class DrawingWheelsCombination implements IOrnamentForm { DrawWheels(g,_startPosX + 50, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY); - g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 80, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 101, _startPosY + 50, 10, 3); + DrawSuspension(g, _startPosX, _startPosY); + DrawSuspension(g,_startPosX + 24, _startPosY); + DrawSuspension(g,_startPosX + 53, _startPosY); + DrawSuspension(g,_startPosX + 73, _startPosY); CaterpillarStar(g,_startPosX + 5, _startPosY + 12); CaterpillarStar(g,_startPosX + 30, _startPosY + 12); @@ -96,10 +102,10 @@ public class DrawingWheelsCombination implements IOrnamentForm { DrawWheels(g,_startPosX + 75, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY); - g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 80, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 101, _startPosY + 50, 10, 3); + DrawSuspension(g, _startPosX, _startPosY); + DrawSuspension(g,_startPosX + 24, _startPosY); + DrawSuspension(g,_startPosX + 53, _startPosY); + DrawSuspension(g,_startPosX + 73, _startPosY); CaterpillarStar(g,_startPosX + 5, _startPosY + 12); CaterpillarStar(g,_startPosX + 30, _startPosY + 12);