Add enemies coords
This commit is contained in:
parent
4158e57c78
commit
c3d05b56bb
@ -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() {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user