@Override
    public void paint(Graphics g) {
        super.paint(g);
        player.draw(g);
        Font font = new Font("Courier New", Font.PLAIN, 32);
        g.setFont(font);
        g.setColor(Color.WHITE);
        Graphics2D g2d = (Graphics2D) g;
        FontRenderContext frc = g2d.getFontRenderContext();
        if (loseTimer == -1 && winTimer == 30) {
            //If in the game screen
            for (Enemy obj : enemies.values()) {
                //Draw all the enemies
                obj.draw(g);
            }
            for (Bullet obj : bullets.values()) {
                //Draw all the bullets
                obj.draw(g);
            }
            for (Explosion obj : explosions.values()) {
                //Draw the exploding enemies
                obj.draw(g);
            }
            for (Wall obj : walls.values()) {
                //Draw the wall parts
                obj.draw(g);
            }
        } else if (loseTimer > 0) {
            //Lost, write losing message
            TextLayout layout = new TextLayout("GAME OVER", font, frc);
            g.drawString("GAME OVER", 800 / 2 - (int) layout.getAdvance() / 2, 800 / 2 - 32 / 2);
        } else if (enemies.isEmpty()) {
            //Won, write victory message
            TextLayout layout = new TextLayout("WAVE CLEAR", font, frc);
            g.drawString("WAVE CLEAR", 800 / 2 - (int) layout.getAdvance() / 2, 800 / 2 - 32 / 2);
        }
        //Draw the HUD with score
        g.drawString("Score: " + score, 500, 764);
        g.drawLine(0, 700, 800, 700);
        Toolkit.getDefaultToolkit().sync();
        g.dispose();
    }