public void actionPerformed(ActionEvent e) {

    if (enemies.isEmpty()) {
      newWave = true;

      waveNum++;
      incEnemies += 2;

      if (waveNum == 14) {
        ingame = false;
        gamewin = true;
      } // end if
      else initEnemies();
    } // end if

    ArrayList as = link.getArrows();

    for (int i = 0; i < as.size(); i++) {
      Arrow a = (Arrow) as.get(i);
      if (a.isVisible()) {
        a.move();
      } else {
        as.remove(i);
      }
    } // end for

    for (int i = 0; i < enemies.size(); i++) {
      Enemy en = (Enemy) enemies.get(i);
      if (en.isVisible()) {
        en.move();
      } else {
        enemies.remove(i);
      }
    } // end for

    link.move();
    checkCollisions();
    repaint();
  } // end actionPerformed
  public void paint(Graphics g) {
    super.paint(g);

    if (ingame) {

      Graphics2D g2d = (Graphics2D) g;

      if (link.isVisible()) {
        g2d.drawImage(link.getImage(), link.getX(), link.getY(), this);
      } // end inner if

      ArrayList as = link.getArrows();

      for (int i = 0; i < as.size(); i++) {
        Arrow a = (Arrow) as.get(i);
        g.setColor(new Color(96, 64, 32));
        g.fillRect(a.getX(), a.getY(), a.width, a.height);

        g.setColor(Color.GRAY);
        int[] xPoints = {a.getX() + a.width, a.getX() + a.width + 10, a.getX() + a.width};
        int[] yPoints = {a.getY() + a.height + 2, a.getY() + (a.height / 2), a.getY() - 2};
        g.fillPolygon(xPoints, yPoints, 3);
      } // end for

      for (int i = 0; i < enemies.size(); i++) {
        Enemy en = (Enemy) enemies.get(i);
        if (en.isVisible()) {
          g2d.drawImage(en.getImage(), en.getX(), en.getY(), this);
        } // end inner if
      } // end for

      g2d.setColor(Color.WHITE);
      g2d.drawString("Enemies left: " + enemies.size(), 5, 15);

      if (waveNum < 13) {
        g2d.setColor(Color.WHITE);
        g2d.drawString("Wave: " + waveNum, 5, 30);
      } else {
        g2d.setColor(Color.WHITE);
        g2d.drawString("Final Wave!", 5, 30);
      }

    } else if (gamewin) {
      String msg = "You Win!";
      Font small = new Font("Helvetica", Font.BOLD, 14);
      FontMetrics metr = this.getFontMetrics(small);

      g.setColor(Color.white);
      g.setFont(small);
      g.drawString(msg, (600 - metr.stringWidth(msg)) / 2, 600 / 2);
    } else {
      String msg = "Game Over";
      Font small = new Font("Helvetica", Font.BOLD, 14);
      FontMetrics metr = this.getFontMetrics(small);

      g.setColor(Color.white);
      g.setFont(small);
      g.drawString(msg, (600 - metr.stringWidth(msg)) / 2, 600 / 2);
    } // end outter if

    Toolkit.getDefaultToolkit().sync();
    g.dispose();
  } // end paint