Пример #1
0
 public void drawEnemy(Graphics g) {
   Graphics2D g2d = (Graphics2D) g;
   for (Enemy i : enemyList) {
     if (i.getFlip()) {
       g2d.drawImage(
           i.getPics().get(i.getCounter()),
           i.getX() + i.getWidth(),
           i.getY(),
           -i.getWidth(),
           i.getHeight(),
           null); // flips the image if the flip is true
     } else {
       g.drawImage(
           i.getPics().get(i.getCounter()), i.getX(), i.getY(), i.getWidth(), i.getHeight(), null);
     }
     i.count();
     i.setDirection();
     i.move();
   }
 }
Пример #2
0
 public void moveEnemies() {
   for (Enemy i : enemyList) {
     i.move();
   }
 }