diff --git a/Tank/src/DrawingStarOrnament.java b/Tank/src/DrawingStarOrnament.java index 21dddcb..e1ce0e9 100644 --- a/Tank/src/DrawingStarOrnament.java +++ b/Tank/src/DrawingStarOrnament.java @@ -2,7 +2,7 @@ import java.awt.*; public class DrawingStarOrnament implements IOrnamentForm { private CountWheels wheels; - private Color additionalColor; + private Color StarColor; public CountWheels getNumWheel() { return wheels; } @@ -25,9 +25,9 @@ public class DrawingStarOrnament implements IOrnamentForm { } public void CaterpillarStar(Graphics g, int _startPosX, int _startPosY) { - additionalColor = Color.RED; - g.setColor(additionalColor); - int xPontsStar[] = {_startPosX + 15, _startPosX + 18, _startPosX + 21, _startPosX + 18, _startPosX + 19, _startPosX + 16, _startPosX + 12, _startPosX + 13, _startPosX + 12, _startPosX + 15, _startPosX + 16}; + StarColor = Color.RED; + g.setColor(StarColor); + int xPontsStar[] = {_startPosX + 15, _startPosX + 18, _startPosX + 21, _startPosX + 18, _startPosX + 19, _startPosX + 16, _startPosX + 12, _startPosX + 12, _startPosX + 11, _startPosX + 15, _startPosX + 16}; int yPontsStar[] = {_startPosY + 35, _startPosY + 38, _startPosY + 38, _startPosY + 42, _startPosY + 45, _startPosY + 42, _startPosY + 45, _startPosY + 41, _startPosY + 38, _startPosY + 38, _startPosY + 35}; g.drawPolygon(xPontsStar, yPontsStar, xPontsStar.length); g.fillPolygon(xPontsStar, yPontsStar, xPontsStar.length); @@ -61,7 +61,6 @@ public class DrawingStarOrnament implements IOrnamentForm { DrawWheels(g,_startPosX, _startPosY); DrawWheels(g,_startPosX + 25, _startPosY); DrawWheels(g,_startPosX + 50, _startPosY); - DrawWheels(g,_startPosX + 75, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY); CaterpillarStar(g,_startPosX + 5, _startPosY + 12); diff --git a/Tank/src/DrawingSuspensionOrnament.java b/Tank/src/DrawingSuspensionOrnament.java index ea2229c..32f1953 100644 --- a/Tank/src/DrawingSuspensionOrnament.java +++ b/Tank/src/DrawingSuspensionOrnament.java @@ -2,7 +2,7 @@ import java.awt.*; public class DrawingSuspensionOrnament implements IOrnamentForm { private CountWheels wheels; - private Color additionalColor; + private Color SuspensionColor; public CountWheels getNumWheel() { return wheels; } @@ -24,19 +24,24 @@ public class DrawingSuspensionOrnament implements IOrnamentForm { } } - public void DrawWheels(Graphics g, int _startPosX, int _startPosY){ + public void DrawWheels(Graphics g, int _startPosX, int _startPosY) { g.setColor(Color.BLACK); 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) { - if (wheels == CountWheels.Two){ + if (wheels == CountWheels.Two) { DrawWheels(g,_startPosX, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY); - additionalColor = Color.RED; - g.setColor(additionalColor); - 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) { @@ -44,9 +49,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) { @@ -56,10 +61,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 88e5e03..5712a20 100644 --- a/Tank/src/DrawingWheelsCombination.java +++ b/Tank/src/DrawingWheelsCombination.java @@ -2,13 +2,13 @@ import java.awt.*; public class DrawingWheelsCombination implements IOrnamentForm { private CountWheels wheels; - private Color additionalColor; + private Color CombinationColor; public CountWheels getNumWheel() { return wheels; } public void setDigit(int number) { - switch(number){ + switch(number) { case 2: wheels = CountWheels.Two; break; @@ -25,14 +25,20 @@ public class DrawingWheelsCombination implements IOrnamentForm { } public void CaterpillarStar(Graphics g, int _startPosX, int _startPosY) { - additionalColor = Color.RED; - g.setColor(additionalColor); + CombinationColor = Color.RED; + g.setColor(CombinationColor); int xPontsStar[] = {_startPosX + 15, _startPosX + 18, _startPosX + 21, _startPosX + 18, _startPosX + 19, _startPosX + 16, _startPosX + 12, _startPosX + 13, _startPosX + 12, _startPosX + 15, _startPosX + 16}; int yPontsStar[] = {_startPosY + 35, _startPosY + 38, _startPosY + 38, _startPosY + 42, _startPosY + 45, _startPosY + 42, _startPosY + 45, _startPosY + 41, _startPosY + 38, _startPosY + 38, _startPosY + 35}; g.drawPolygon(xPontsStar, yPontsStar, xPontsStar.length); 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,8 +49,8 @@ public class DrawingWheelsCombination implements IOrnamentForm { 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); @@ -55,10 +61,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); CaterpillarStar(g,_startPosX + 55, _startPosY + 12); @@ -71,10 +76,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); @@ -89,6 +94,11 @@ public class DrawingWheelsCombination implements IOrnamentForm { DrawWheels(g,_startPosX + 75, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY); + 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); CaterpillarStar(g,_startPosX + 55, _startPosY + 12);