@Override
    public void paintComponent(Graphics g){
        Graphics2D g2 = (Graphics2D) g;
        drawBackground(g2);
        for(Sprite sprite : sprites)
            if(sprite.isLayered()) sprite.draw(g2);
        for(Sprite sprite : sprites)
            if(!sprite.isLayered())sprite.draw(g2);
        for(Sprite sprite : sprites)
            if(sprite.isLayered()) sprite.drawTopLayer(g2);
        if(gameEnding != Status.PLAYING) drawEnding(g2);
    }