From c3d05b56bbef69715931595963cf4f6afa92402e Mon Sep 17 00:00:00 2001 From: Victor Date: Wed, 26 Feb 2014 18:06:33 +0200 Subject: [PATCH] Add enemies coords --- .../src/com/annimon/militaryhero/MainApp.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Military-Hero-Core/src/com/annimon/militaryhero/MainApp.java b/Military-Hero-Core/src/com/annimon/militaryhero/MainApp.java index 8a9f451..6a77419 100644 --- a/Military-Hero-Core/src/com/annimon/militaryhero/MainApp.java +++ b/Military-Hero-Core/src/com/annimon/militaryhero/MainApp.java @@ -10,13 +10,27 @@ import com.annimon.jecp.Keys; */ public class MainApp extends InputProcessor implements ApplicationListener { + private static final int[] COORD = { + 6, 321, 49, 318, 100, 228, 145, 259, 230, 356, + 86, 375, 365, 325, 344, 232, 296, 296, 457, 355, + 480, 260, 530, 288, 500, 288, 590, 297, 617, 343, + 2, 467, 502, 7 + }; + private int width, height; + private Background background; private SniperAim aim; + private Enemy[] enemies; public void onStartApp(int width, int height) { this.width = width; this.height = height; + background = new Background(); aim = new SniperAim(width, height); + enemies = new Enemy[COORD.length / 2]; + for (int i = 0; i < enemies.length; i++) { + enemies[i] = new Enemy(COORD[i * 2], COORD[i * 2 + 1]); + } Jecp.inputListener = this; Keys.numericdAsDpad = true; Keys.wasdAsDpad = true; @@ -29,8 +43,11 @@ public class MainApp extends InputProcessor implements ApplicationListener { } public void onPaint(Graphics g) { - g.setColor(0xFFFFFFFF); - g.fillRect(0, 0, width, height); + background.draw(g); + for (int i = 0; i < enemies.length; i++) { + enemies[i].draw(g); + } + background.drawObstacles(g); aim.draw(g); } @@ -48,6 +65,6 @@ public class MainApp extends InputProcessor implements ApplicationListener { } public void isFirePressed() { + } - }