function Livehud(game) {
    //SD/ Get params
    this.game = typeof game !== 'undefined' ? game : null ;
    
	//LG/ Calculate and set number of lives (depending on the number of players)
	this.nbLives = this.game.players.length + this.game.players.length / 2 + 6 ;
	console.log(this.nbLives);
	
    
	//LG/ Init variables
        this.width = 25 * this.nbLives / 3 ;
	this.height = 25 * this.nbLives / 2 ;
	this.livehudshape = new Kinetic.Rect({
        width: this.width,
		height: this.height,
		x: this.game.stage.width() - this.width - 10,
        y: this.game.stage.height() - this.height - 10,
        fill: 'yellow',
        stroke: 'black',
        strokeWidth: 1
    });
	
	//LG / Put the correct number of lives/hearts on the livehudshape
	this.drawHearts(this.nbLives);
    
};

/**
 * Draw text on layer
 * @returns {undefined}
 */
Livehud.prototype.display = function() {
    var _this = this ;
    this.imgHeart.onload = function() {
		_this.game.hudLayer.add(_this.livehudshape) ;
        _this.game.hudLayer.add(_this.heartShape) ;   
    } ;
} ;


/**
 * Update livehud to display the new number of lives that remains
 *@params: number of lives to remove! 
 *@returns {undefined}
 */
 
Livehud.prototype.updateLivehudshape = function(nbLives) {
    console.log(this.nbLives) ;
	this.nbLives = this.nbLives - nbLives ;
	console.log(this.nbLives) ;
            
    this.game.hudLayer.draw() ;
};


/**
 * Puts the 
 *@params: number of lives to remove! 
 *@returns {undefined}
 */
Livehud.prototype.drawHearts = function(nbLives) {
    this.widthHeart = 24 ;
    this.heightHeart = 23 ;
    this.imgHeart = new Image() ;
    this.heartShape = new Kinetic.Image({
            x: this.game.stage.width() - this.width - 10,
            y: this.game.stage.height() - this.height - 10,
            image: this.imgHeart,
            width: this.widthHeart + 1,
            height: this.heightHeart + 2,
            //offsetX: this.heightHeart / 2,
            //offsetY: 57,
        });
    this.imgHeart.src = "img/heart.png" ;
};

