diff --git a/resources/images/0.gif b/resources/images/0.gif new file mode 100644 index 0000000..79c5218 Binary files /dev/null and b/resources/images/0.gif differ diff --git a/resources/images/1.gif b/resources/images/1.gif new file mode 100644 index 0000000..eface51 Binary files /dev/null and b/resources/images/1.gif differ diff --git a/resources/images/10.gif b/resources/images/10.gif new file mode 100644 index 0000000..ffd49b8 Binary files /dev/null and b/resources/images/10.gif differ diff --git a/resources/images/2.gif b/resources/images/2.gif new file mode 100644 index 0000000..b88b47e Binary files /dev/null and b/resources/images/2.gif differ diff --git a/resources/images/3.gif b/resources/images/3.gif new file mode 100644 index 0000000..88e81e8 Binary files /dev/null and b/resources/images/3.gif differ diff --git a/resources/images/4.gif b/resources/images/4.gif new file mode 100644 index 0000000..4cc91ab Binary files /dev/null and b/resources/images/4.gif differ diff --git a/resources/images/5.gif b/resources/images/5.gif new file mode 100644 index 0000000..c1cc5d7 Binary files /dev/null and b/resources/images/5.gif differ diff --git a/resources/images/6.gif b/resources/images/6.gif new file mode 100644 index 0000000..4f43fc7 Binary files /dev/null and b/resources/images/6.gif differ diff --git a/resources/images/7.gif b/resources/images/7.gif new file mode 100644 index 0000000..20358ba Binary files /dev/null and b/resources/images/7.gif differ diff --git a/resources/images/8.gif b/resources/images/8.gif new file mode 100644 index 0000000..ae410c9 Binary files /dev/null and b/resources/images/8.gif differ diff --git a/resources/images/9.gif b/resources/images/9.gif new file mode 100644 index 0000000..11efedd Binary files /dev/null and b/resources/images/9.gif differ diff --git a/resources/images/BadTank1.png b/resources/images/BadTank1.png new file mode 100644 index 0000000..d661b80 Binary files /dev/null and b/resources/images/BadTank1.png differ diff --git a/resources/images/BadTank2.png b/resources/images/BadTank2.png new file mode 100644 index 0000000..c2a2b01 Binary files /dev/null and b/resources/images/BadTank2.png differ diff --git a/resources/images/GoodTank1.png b/resources/images/GoodTank1.png new file mode 100644 index 0000000..8afb8b0 Binary files /dev/null and b/resources/images/GoodTank1.png differ diff --git a/resources/images/GoodTank2.png b/resources/images/GoodTank2.png new file mode 100644 index 0000000..a1b131a Binary files /dev/null and b/resources/images/GoodTank2.png differ diff --git a/resources/images/bulletD.gif b/resources/images/bulletD.gif new file mode 100644 index 0000000..be33e5f Binary files /dev/null and b/resources/images/bulletD.gif differ diff --git a/resources/images/bulletL.gif b/resources/images/bulletL.gif new file mode 100644 index 0000000..1ab986a Binary files /dev/null and b/resources/images/bulletL.gif differ diff --git a/resources/images/bulletR.gif b/resources/images/bulletR.gif new file mode 100644 index 0000000..514e982 Binary files /dev/null and b/resources/images/bulletR.gif differ diff --git a/resources/images/bulletU.gif b/resources/images/bulletU.gif new file mode 100644 index 0000000..274c570 Binary files /dev/null and b/resources/images/bulletU.gif differ diff --git a/resources/images/bulletU.png b/resources/images/bulletU.png new file mode 100644 index 0000000..f6f7203 Binary files /dev/null and b/resources/images/bulletU.png differ diff --git a/resources/images/e1.gif b/resources/images/e1.gif new file mode 100644 index 0000000..4ba0e92 Binary files /dev/null and b/resources/images/e1.gif differ diff --git a/resources/images/e10.gif b/resources/images/e10.gif new file mode 100644 index 0000000..5667574 Binary files /dev/null and b/resources/images/e10.gif differ diff --git a/resources/images/e11.gif b/resources/images/e11.gif new file mode 100644 index 0000000..7d6747c Binary files /dev/null and b/resources/images/e11.gif differ diff --git a/resources/images/e12.gif b/resources/images/e12.gif new file mode 100644 index 0000000..97f85df Binary files /dev/null and b/resources/images/e12.gif differ diff --git a/resources/images/e13.gif b/resources/images/e13.gif new file mode 100644 index 0000000..473cab1 Binary files /dev/null and b/resources/images/e13.gif differ diff --git a/resources/images/e14.gif b/resources/images/e14.gif new file mode 100644 index 0000000..676fa2a Binary files /dev/null and b/resources/images/e14.gif differ diff --git a/resources/images/e15.gif b/resources/images/e15.gif new file mode 100644 index 0000000..d3795f8 Binary files /dev/null and b/resources/images/e15.gif differ diff --git a/resources/images/e16.gif b/resources/images/e16.gif new file mode 100644 index 0000000..4a913c3 Binary files /dev/null and b/resources/images/e16.gif differ diff --git a/resources/images/e2.gif b/resources/images/e2.gif new file mode 100644 index 0000000..f22cbb8 Binary files /dev/null and b/resources/images/e2.gif differ diff --git a/resources/images/e3.gif b/resources/images/e3.gif new file mode 100644 index 0000000..58c1e2a Binary files /dev/null and b/resources/images/e3.gif differ diff --git a/resources/images/e4.gif b/resources/images/e4.gif new file mode 100644 index 0000000..981e9e2 Binary files /dev/null and b/resources/images/e4.gif differ diff --git a/resources/images/e5.gif b/resources/images/e5.gif new file mode 100644 index 0000000..fc93522 Binary files /dev/null and b/resources/images/e5.gif differ diff --git a/resources/images/e6.gif b/resources/images/e6.gif new file mode 100644 index 0000000..1bba69a Binary files /dev/null and b/resources/images/e6.gif differ diff --git a/resources/images/e7.gif b/resources/images/e7.gif new file mode 100644 index 0000000..9719061 Binary files /dev/null and b/resources/images/e7.gif differ diff --git a/resources/images/e8.gif b/resources/images/e8.gif new file mode 100644 index 0000000..710d7ea Binary files /dev/null and b/resources/images/e8.gif differ diff --git a/resources/images/e9.gif b/resources/images/e9.gif new file mode 100644 index 0000000..0535c88 Binary files /dev/null and b/resources/images/e9.gif differ diff --git a/resources/images/missileLD.gif b/resources/images/missileLD.gif new file mode 100644 index 0000000..4a1d311 Binary files /dev/null and b/resources/images/missileLD.gif differ diff --git a/resources/images/missileLU.gif b/resources/images/missileLU.gif new file mode 100644 index 0000000..e1fb913 Binary files /dev/null and b/resources/images/missileLU.gif differ diff --git a/resources/images/missileRD.gif b/resources/images/missileRD.gif new file mode 100644 index 0000000..d58cc9c Binary files /dev/null and b/resources/images/missileRD.gif differ diff --git a/resources/images/missileRU.gif b/resources/images/missileRU.gif new file mode 100644 index 0000000..1eed195 Binary files /dev/null and b/resources/images/missileRU.gif differ diff --git a/resources/images/square0.jpg b/resources/images/square0.jpg new file mode 100644 index 0000000..5b80bf0 Binary files /dev/null and b/resources/images/square0.jpg differ diff --git a/resources/images/square1.jpg b/resources/images/square1.jpg new file mode 100644 index 0000000..324341d Binary files /dev/null and b/resources/images/square1.jpg differ diff --git a/resources/images/square2.jpg b/resources/images/square2.jpg new file mode 100644 index 0000000..be66ad8 Binary files /dev/null and b/resources/images/square2.jpg differ diff --git a/resources/images/square3.jpg b/resources/images/square3.jpg new file mode 100644 index 0000000..109430b Binary files /dev/null and b/resources/images/square3.jpg differ diff --git a/resources/images/square4.jpg b/resources/images/square4.jpg new file mode 100644 index 0000000..ba00d68 Binary files /dev/null and b/resources/images/square4.jpg differ diff --git a/resources/images/square5.jpg b/resources/images/square5.jpg new file mode 100644 index 0000000..56198aa Binary files /dev/null and b/resources/images/square5.jpg differ diff --git a/resources/images/square6.jpg b/resources/images/square6.jpg new file mode 100644 index 0000000..2923b9a Binary files /dev/null and b/resources/images/square6.jpg differ diff --git a/resources/images/tank.png b/resources/images/tank.png new file mode 100644 index 0000000..54c82ba Binary files /dev/null and b/resources/images/tank.png differ diff --git a/resources/images/tankD.gif b/resources/images/tankD.gif new file mode 100644 index 0000000..4c29adf Binary files /dev/null and b/resources/images/tankD.gif differ diff --git a/resources/images/tankL.gif b/resources/images/tankL.gif new file mode 100644 index 0000000..af51e88 Binary files /dev/null and b/resources/images/tankL.gif differ diff --git a/resources/images/tankLD.gif b/resources/images/tankLD.gif new file mode 100644 index 0000000..2f6bca7 Binary files /dev/null and b/resources/images/tankLD.gif differ diff --git a/resources/images/tankLU.gif b/resources/images/tankLU.gif new file mode 100644 index 0000000..1e1a514 Binary files /dev/null and b/resources/images/tankLU.gif differ diff --git a/resources/images/tankR.gif b/resources/images/tankR.gif new file mode 100644 index 0000000..a83f583 Binary files /dev/null and b/resources/images/tankR.gif differ diff --git a/resources/images/tankRD.gif b/resources/images/tankRD.gif new file mode 100644 index 0000000..60e2e81 Binary files /dev/null and b/resources/images/tankRD.gif differ diff --git a/resources/images/tankRU.gif b/resources/images/tankRU.gif new file mode 100644 index 0000000..d66ef25 Binary files /dev/null and b/resources/images/tankRU.gif differ diff --git a/resources/images/tankU.gif b/resources/images/tankU.gif new file mode 100644 index 0000000..8825a23 Binary files /dev/null and b/resources/images/tankU.gif differ diff --git a/src/com/msb/ResourcesMgr.java b/src/com/msb/ResourcesMgr.java new file mode 100644 index 0000000..9e2caff --- /dev/null +++ b/src/com/msb/ResourcesMgr.java @@ -0,0 +1,27 @@ +package com.msb; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; + +/** + * @Author bingor + * @Date 2022-10-01 16:50 + * @Description: com.msb + * @Version: 1.0 + */ +public class ResourcesMgr { + + public static BufferedImage tankL, tankR, tankU, tankD; + + static { + try { + tankL = ImageIO.read(ResourcesMgr.class.getClassLoader().getResourceAsStream("images/tankL.gif")); + tankR = ImageIO.read(ResourcesMgr.class.getClassLoader().getResourceAsStream("images/tankR.gif")); + tankU = ImageIO.read(ResourcesMgr.class.getClassLoader().getResourceAsStream("images/tankU.gif")); + tankD = ImageIO.read(ResourcesMgr.class.getClassLoader().getResourceAsStream("images/tankD.gif")); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/com/msb/Tank.java b/src/com/msb/Tank.java index 2df4bea..7819564 100644 --- a/src/com/msb/Tank.java +++ b/src/com/msb/Tank.java @@ -25,10 +25,17 @@ public class Tank { } public void paint(Graphics g) { - Color color = g.getColor(); + /* Color color = g.getColor(); g.setColor(Color.YELLOW); g.fillRect(x, y, 50, 50); - g.setColor(color); + g.setColor(color);*/ + switch (dir) { + case UP: g.drawImage(ResourcesMgr.tankU, x, y, null); break; + case DOWN: g.drawImage(ResourcesMgr.tankD, x, y, null); break; + case LEFT: g.drawImage(ResourcesMgr.tankL, x, y, null); break; + case RIGHT: g.drawImage(ResourcesMgr.tankR, x, y, null); break; + default: break; + } moving(); } diff --git a/src/com/msb/test/CommonTest.java b/src/com/msb/test/CommonTest.java index 3387a99..3e1aa76 100644 --- a/src/com/msb/test/CommonTest.java +++ b/src/com/msb/test/CommonTest.java @@ -20,6 +20,8 @@ public class CommonTest { public void testReadImage() throws IOException { BufferedImage bufferedImage = ImageIO.read(new File("E:\\myfile\\msb_马士兵教育体系\\课程下载的资源\\MCA高级构架师\\73-坦克大战(一期)\\images\\tankD.gif")); Assert.assertNotNull(bufferedImage); + BufferedImage image = ImageIO.read(CommonTest.class.getClassLoader().getResourceAsStream("images/tankD.gif")); + Assert.assertNotNull(image); } }