From 143fc0e02245c4c2cb3a7462e32930c7e441f5c9 Mon Sep 17 00:00:00 2001 From: AnnZhimol Date: Tue, 20 Sep 2022 15:46:45 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=B0=D1=8F=20=D0=BB?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0.=20=D0=A3=D1=81?= =?UTF-8?q?=D0=BB=D0=BE=D0=B6=D0=BD=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F.=20?= =?UTF-8?q?=D0=A1=20=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D1=8B=D0=BC=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=D0=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 3 +++ .idea/WarshipHard.iml | 11 ++++++++++ .idea/misc.xml | 6 +++++ .idea/modules.xml | 8 +++++++ .idea/vcs.xml | 6 +++++ Resource/arrowDown.jpg | Bin 0 -> 1179 bytes Resource/arrowLeft.jpg | Bin 0 -> 1194 bytes Resource/arrowRight.jpg | Bin 0 -> 1196 bytes Resource/arrowUp.jpg | Bin 0 -> 1191 bytes src/BlockCount.java | 13 +++++++++++ src/DrawingBlock.java | 47 ++++++++++++++++++++++++++++++++++++++++ src/DrawingWarship.java | 12 +++++----- 12 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/WarshipHard.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 Resource/arrowDown.jpg create mode 100644 Resource/arrowLeft.jpg create mode 100644 Resource/arrowRight.jpg create mode 100644 Resource/arrowUp.jpg create mode 100644 src/BlockCount.java create mode 100644 src/DrawingBlock.java 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/.idea/WarshipHard.iml b/.idea/WarshipHard.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/.idea/WarshipHard.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /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..082ca23 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ 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 diff --git a/Resource/arrowDown.jpg b/Resource/arrowDown.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4813a5b13f10de1f7f3963ed49824b411c263211 GIT binary patch literal 1179 zcmex=``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivwh= zDOELf4NWZ*Q!{f5ODks=S2uSLPp{yR(6I1`$f)F$)U@=B%&g*)(z5c3%Btp;*0%PJ z&aO$5r%atTea6gLixw|gx@`H1m8&*w-m-Pu_8mKS9XfpE=&|D`PM*4S`O4L6*Kgds z_3+W-Cr_U}fAR9w$4{TXeEs(Q$Io9Ne=#yJL%ap|8JfQYf&OA*VPR%r2lxYE z#}NLy#lXYN2#h>tK?ZwDTKlp1SfA{4t*%rfN^TSKi^N;T5dS#!x)~Po8aqGEh zNB13Gc;nX1sAF}nR(7T)v9HYJw>z|#{hRL({S|-ge{6j;*ZQcG3;**9x9ruCDLvji z7x!#Pe4J$YU_zDP36nS0bG9F}|Do}|uf}*?)Zvd@8a07Styi616?NM^f5m~l=Ddx` zQ}}krRvy16`fK8Y{Spxsw-0}-+BUmX^zGa$nl|PF=_wm`oZ4|-LGZ>W4uvo4kK|@Q zwA=acJjaVTl`CuNPA+@xZ*=4598axd!o_djv{xK_-+Y_p?|+8>3@lGR#=icey6@8S zv}v|_|1xr??$Ys7o}B;St>S-%#=t~5_uqLn%2!I(i@QF$m~-sbD~-4BXNLccIsIw1 z{I|%m6?Uua_ZV;dZT0VZ**?(^KQGi&Kf7~u`E8@jTT=>tZklmG{>Aye%3BM}{TT8Z zuD_7)+M~F%;RIhm>REpHMVLo`d{0Erd$9p=mlwDX7sB~P4chxEbhA#^n|K9`vnM~@P literal 0 HcmV?d00001 diff --git a/Resource/arrowLeft.jpg b/Resource/arrowLeft.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0f9441d286a26ec777290220c9005bc1bb7d728f GIT binary patch literal 1194 zcmex=``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivTDoi-j64Z8S2#W<;`iIYoATtZSx zRZU$(Q_IBE%-q7#%Gt%$&E3P(D>x)HEIcAIDmf)JEj=SMtGJ}Jth}PKs=1}Lt-YhO zYtrN?Q>RUzF>}_U#Y>hhTfSoDs!f}>Y~8kf$Ie}c4j(ys?D&b3r!HN-a`oEv8#iw~ zeDwIq(`V0LynOZX)8{W=zkUDl^B2fpj10^WZ^3%h$X_cGze8aDXdi$F2 z-)VoG_U)PGEBENU!!{i+XVy(#H{R}C5qnC`DJRdcWvN(CNWcCd*=+T zcawRqe6ahp&OcT3y`1FVsqgkl{?XqVEA4*akN-#RfPhK&UU#j}PM%PIRa-gl_B*!6 zCm-al7Ck?2kNoelY_nNY%>FY7Y^k;vddcT>vNB!hcD#de(~EG98omYr7s7v)3M}*)76&@a5%8d*A=#>|S~HBl{sc^ABo^wNIulzI!`sn{{8! zddpPLz*>}w&r_!+*deMUps%O{)gIshPExfLA?G)%`g2}=Mm#6yJq6r yz4P4dt=Q5gZ)a_q*CO>h*z;1t#kWEnp`oEpy{kkR*q9nD82A`uH4W$gzX<@aI^Ht? literal 0 HcmV?d00001 diff --git a/Resource/arrowRight.jpg b/Resource/arrowRight.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cea4be560b455dbfe13920c06e392505edc77148 GIT binary patch literal 1196 zcmex=``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivTDoi-j64Z8S2#W<;`iIYoATtZSx zRZU$(Q_IBE%-q7#%Gt%$&E3P(D>x)HEIcAIDmf)JEj=SMtGJ}Jth}PKs=1}Lt-YhO zYtrN?Q>RUzF>}_U#Y>hhTfSoDs!f}>Y~8kf$Ie}c4j(ys?D&b3r!HN-a`oEv8#iw~ zeDwIq(`V0LynOZX)8{W=zkUDl^B2fpj10^WZ^3yO7DZy(;z{71QP-RtY~)3^1uXiRMQ9OL8W5~yfzoIH6B zgQe*Q`_BIi4;Ife{m8cD?ZS*(byJh)Pt2d^J+ptO;zaig`j6vs|1+@i{OGKI)PGCs z^m}n{|sBsJg61Swtr}U;J!rkYbm?c>uU6_+qgd5IW=Y4 zU8PxKlf)U?-GY`Euo#>?_#$(G-NYY(KqI-XDPBq3{;_O6$F}0;(&RmhivI*|Oztnu zyI*qsUY#IN;;}E^{gBJ)k#C;`9Guw9=jN`wLZOMjAp5iXw~oKlqaVIqW2gIJ>e9zQ zydH`^-@G&Yx7(~E>3kA-H*c#?wUImW>-rn{k9N=fFKk___Hkd@4Tr$1hViTXZGBfAC!qvoS_fq8V zT8B0ZzA~Ke=qYm6|Caf;6>>(G9)E~$G3D-F%c$h>e(TJGo?nF+9!tb1zN%pDmtbDM zyzY=a*Sq{0`_-?$cU*|RpZn>?dewl3{*S!>IbYl9-&Vh2SJdmU{U4^h7R=(`A-Z8> xSj7GLk0x&L_{Lbb_51ynKZdCfb;a)cZERI+Q)SL#U}u(}Aj9}Vb8_``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivwh= zDOELf4NWZ*Q!{f5ODks=S2uSLPp{yR(6I1`$f)F$)U@=B%&g*)(z5c3%Btp;*0%PJ z&aO$5r%atTea6gLixw|gx@`H1m8&*w-m-Pu_8mKS9XfpE=&|D`PM*4S`O4L6*Kgds z_3+W-Cr_U}fAR9w$4{TXeEs(Q$Io9Ne=#yJL%ap|8JfQYf&OA*VPR%r2lxYE z#}NLy#lXYN2#h>tK?Zw<-@hL}Kc1`qV1Db9eY^6F-v0AQjEkJn+{%2tsg{9detm+i5XUO$@G>sY0p+2~!Uc0*^)!{07F{;mwolmESt_uBuvzT(jPfFFnRmw9V*dwUxi zxlitW_lCRvzDDy0)7y0?zWrnQpnJSouJYL0kIY9;Tf0g<+`l<@VydO`5AUC`Rdeqo zFwb(b)Nk9rZF#Sa@EUiyotjtPgnm2I%H%QQ!Jj>v%9j~FUI~AZe)vB_=Pmmq{QNgx zO$#@iu}(>7b>7d2YT-Y-`sO;WKlh*E)+&9*AE)leek^ZS{deZ0TmM?SiECfxwi-|P zq;#jj)~CLr^t?sl`OM#3ufydOKKOTRsZ=dyn_VrlQD*)WueDRKi$%ub+r#sxyfAqyA&_!~YDT z_ivr8O>1t7SfgSq9Fue6i}cTLGJ) z*JFFDKh=+K)FeLMFPJ^;qm96;SyRuxDLCPn5~-TbRd|Q(Xzl0UrZx6g_X+$_+7|so z>iUs?3Ujh1-`dZgnRrPto(y)l{HFY=>Rx_004 yN0Qf4wiQ&AGztb6JZQS9(9`vc|Ka=QgzLQ57OwDDy?W)o@rlQie6@T2-vj_z9_*a} literal 0 HcmV?d00001 diff --git a/src/BlockCount.java b/src/BlockCount.java new file mode 100644 index 0000000..b49dbfe --- /dev/null +++ b/src/BlockCount.java @@ -0,0 +1,13 @@ +public enum BlockCount { + TwoBlocks(2), + FourBlocks(4), + SixBlocks(6); + + private final int value; + BlockCount(int count){ + value=count; + } + public int GetBlockCount(){ + return value; + } +} diff --git a/src/DrawingBlock.java b/src/DrawingBlock.java new file mode 100644 index 0000000..0189e61 --- /dev/null +++ b/src/DrawingBlock.java @@ -0,0 +1,47 @@ +import java.awt.*; + +public class DrawingBlock { + + private BlockCount _Block; + + public void SetBlockCount(int count){ + for (BlockCount temp: BlockCount.values()) + if (temp.GetBlockCount() == count){ + _Block=temp; + return; + } + } + + public void DrawBlock(Graphics2D g,int _startPosX, int _startPosY) { + if (_Block.GetBlockCount() >= 2) { + g.setColor(Color.GRAY); + g.fillRect(_startPosX + 25, _startPosY + 10, 10, 10); + g.setColor(Color.BLACK); + g.drawRect(_startPosX + 25, _startPosY + 10, 10, 10); + g.setColor(Color.GRAY); + g.fillRect(_startPosX + 25, _startPosY + 20, 10, 10); + g.setColor(Color.BLACK); + g.drawRect(_startPosX + 25, _startPosY + 20, 10, 10); + } + if (_Block.GetBlockCount() >= 4) { + g.setColor(Color.GRAY); + g.fillRect(_startPosX+35,_startPosY+10,10,10); + g.setColor(Color.BLACK); + g.drawRect(_startPosX+35,_startPosY+10,10,10); + g.setColor(Color.GRAY); + g.fillRect(_startPosX+35,_startPosY+20,10,10); + g.setColor(Color.BLACK); + g.drawRect(_startPosX+35,_startPosY+20,10,10); + } + if (_Block.GetBlockCount() >= 6) { + g.setColor(Color.GRAY); + g.fillRect(_startPosX+45,_startPosY+10,10,10); + g.setColor(Color.BLACK); + g.drawRect(_startPosX+45,_startPosY+10,10,10); + g.setColor(Color.GRAY); + g.fillRect(_startPosX+45,_startPosY+20,10,10); + g.setColor(Color.BLACK); + g.drawRect(_startPosX+45,_startPosY+20,10,10); + } + } +} diff --git a/src/DrawingWarship.java b/src/DrawingWarship.java index 9c929f0..440d8ad 100644 --- a/src/DrawingWarship.java +++ b/src/DrawingWarship.java @@ -5,6 +5,7 @@ public class DrawingWarship { public EntityWarship GetWarship(){ return Warship; } + public DrawingBlock Blocks; private int _startPosX; private int _startPosY; private Integer _pictureWidth = null; @@ -16,6 +17,8 @@ public class DrawingWarship { { Warship = new EntityWarship(); Warship.Init(speed, weight, bodyColor); + Blocks= new DrawingBlock(); + Blocks.SetBlockCount(2*(int)(Math.random()*3+1)); } public void SetPosition(int x, int y, int width, int height) @@ -95,17 +98,12 @@ public class DrawingWarship { g2.fillRect(_startPosX, _startPosY + 5, 5, 10); g2.fillRect(_startPosX, _startPosY + 25, 5, 10); - g2.setColor(Color.DARK_GRAY); - - g2.drawRect(_startPosX + 30, _startPosY + 15, 20, 10); - g2.fillRect(_startPosX+30, _startPosY + 15, 20, 10); - g2.drawRect(_startPosX + 50, _startPosY + 10, 10, 20); - g2.fillRect(_startPosX + 50, _startPosY + 10, 10, 20); - g2.setColor(Color.BLUE); g2.drawOval(_startPosX + 70, _startPosY + 15, 10, 10); g2.fillOval(_startPosX + 70, _startPosY + 15, 10, 10); + + Blocks.DrawBlock(g2, _startPosX,_startPosY); } public void ChangeBorders(int width,int height)