@Override
	public void paintComponent(Graphics g) {
		// lancement de la musique de fond
		SoundEffect.MUSIC.playLoop();
		
        super.paintComponent(g);
        g.drawImage(backgroundImage, 0, 0, getWidth(), getHeight(), this);

        int nbLosers = 0;
        int winner = 0;
        
        for(int i = 0; i < players.length; ++i) {
        	
        	g.translate(this.getWidth() / players.length * i, 0);
        	
        	players[i].getGameScreen().draw(g, this.getWidth() / players.length, this.getHeight(), players[i].getIndice(), players[i].isOver(), this);
        	
        	g.translate(-this.getWidth() / players.length * i, 0);
        	
        	
        	if(players[i].isOver()) {
        		++nbLosers;
        	} else {
        		winner = i + 1;
        	}
        }
        
        if(nbLosers == players.length - 1 && players.length > 1) {
        	// arret de la musique de fond
        	SoundEffect.MUSIC.stop();
        	if(!players[winner - 1].isWin()) SoundEffect.WIN.play();
        	//affichage des résultats
        	g.setColor(Color.black);
        	g.fillRect(0, this.getHeight() / 3, this.getWidth(), this.getHeight() / 3);
        	g.setColor(Color.red);
        	g.setFont(minecraftia.deriveFont(Font.PLAIN, this.getWidth() / 20));
        	g.drawString("Le joueur " + winner + " gagne !", this.getWidth() / 6, this.getHeight() / 2);
        	g.setFont(minecraftia.deriveFont(Font.PLAIN, this.getWidth() / 40));
        	g.drawString("Appuyez sur Entrée", this.getWidth() / 3, this.getHeight() * 3 / 5);
        	
        	players[winner - 1].setWin(true);
        } else if(nbLosers == players.length && players.length > 1) {
        	// arret de la musique de fond
        	SoundEffect.MUSIC.stop();
        	//affichage des résultats
        	g.setColor(Color.black);
        	g.fillRect(0, this.getHeight() / 3, this.getWidth(), this.getHeight() / 3);
        	g.setColor(Color.red);
        	g.setFont(minecraftia.deriveFont(Font.PLAIN, this.getWidth() / 20));
        	g.drawString("Egalité !", this.getWidth() * 2 / 5, this.getHeight() / 2);
        	g.setFont(minecraftia.deriveFont(Font.PLAIN, this.getWidth() / 40));
        	g.drawString("Appuyez sur Entrée", this.getWidth() / 3, this.getHeight() * 3 / 5);
        } else if(nbLosers == 1 && players.length == 1) {
        	// arret de la musique de fond
        	SoundEffect.MUSIC.stop();
        	// bruitage
    		SoundEffect.LOOSE.play();
    		//affichage des résultats
        	g.setColor(Color.black);
        	g.fillRect(0, this.getHeight() / 3, this.getWidth(), this.getHeight() / 3);
        	g.setColor(Color.red);
        	g.setFont(minecraftia.deriveFont(Font.PLAIN, this.getWidth() / 20));
        	g.drawString("Score : " + players[0].getGameScreen().getScore(), this.getWidth() / 4, this.getHeight() / 2);
        	g.setFont(minecraftia.deriveFont(Font.PLAIN, this.getWidth() / 40));
        	g.drawString("Appuyez sur Entrée", this.getWidth() / 3, this.getHeight() * 3 / 5);
        }
	}