diff --git a/Tank/src/DrawingSuspensionOrnament.java b/Tank/src/DrawingSuspensionOrnament.java index 33712f0..7af7ff7 100644 --- a/Tank/src/DrawingSuspensionOrnament.java +++ b/Tank/src/DrawingSuspensionOrnament.java @@ -32,17 +32,22 @@ public class DrawingSuspensionOrnament implements IOrnamentForm { g.fillOval(10 + _startPosX, 42 + _startPosY, 20, 20); } + public void DrawSuspension(Graphics g, int _startPosX, int _startPosY) { + SuspensionColor = Color.BLUE; + g.setColor(SuspensionColor); + g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); + } + 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); if (wheels == CountWheels.Two) { DrawWheels(g,_startPosX, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY); - SuspensionColor = Color.RED; - g.setColor(SuspensionColor); - g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); - g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3); + + DrawSuspension(g, _startPosX, _startPosY); + DrawSuspension(g,_startPosX + 73, _startPosY); } if (wheels == CountWheels.Three) { @@ -50,9 +55,9 @@ public class DrawingSuspensionOrnament 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); + DrawSuspension(g, _startPosX, _startPosY); + DrawSuspension(g,_startPosX + 24, _startPosY); + DrawSuspension(g,_startPosX + 73, _startPosY); } if (wheels == CountWheels.Four || wheels == CountWheels.Five) { @@ -63,10 +68,10 @@ public class DrawingSuspensionOrnament 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); } } } \ No newline at end of file diff --git a/Tank/src/DrawingWheelsCombination.java b/Tank/src/DrawingWheelsCombination.java index 0673bc0..af8f722 100644 --- a/Tank/src/DrawingWheelsCombination.java +++ b/Tank/src/DrawingWheelsCombination.java @@ -72,7 +72,6 @@ public class DrawingWheelsCombination implements IOrnamentForm { DrawSuspension(g,_startPosX + 24, _startPosY); DrawSuspension(g,_startPosX + 73, _startPosY); - CaterpillarStar(g,_startPosX + 5, _startPosY + 12); CaterpillarStar(g,_startPosX + 55, _startPosY + 12); CaterpillarStar(g,_startPosX + 105, _startPosY + 12);