function changeHpBarColour(percentage, elementID) {
    if (percentage >= 75) {
        document.getElementById(elementID).style.background = 'linear-gradient(#33FF33, #27AD27)';
    }
    else if (percentage >= 50 && percentage < 75) {
        document.getElementById(elementID).style.background = 'linear-gradient(#FFFB00, #D6D300)';
    }
    else if (percentage >= 25 && percentage < 50) {
        document.getElementById(elementID).style.background = 'linear-gradient(#FF9700, #D67F00)';
    }
    else if (percentage >= 0 && percentage < 25) {
        document.getElementById(elementID).style.background = 'linear-gradient(#FF0000, #AF0000)';
    }
}
/**
 * Changes colour of the HP bar based on percentage of health remaining.
 * @param {Number} percentage percentage of health remaining.
 * @param {ID} elementID id of the HP bar element.
 */
Changes colour of the HP bar based on percentage of health remaining.
@param {Number} percentage percentage of health remaining.
@param {ID} elementID id of the HP bar element.
Changes colour of the HP bar based on percentage of health remaining . @param { Number } percentage percentage of health remaining . @param { ID } elementID id of the HP bar element .
function changeHpBarColour(percentage, elementID) {
    if (percentage >= 75) {
        document.getElementById(elementID).style.background = 'linear-gradient(#33FF33, #27AD27)';
    }
    else if (percentage >= 50 && percentage < 75) {
        document.getElementById(elementID).style.background = 'linear-gradient(#FFFB00, #D6D300)';
    }
    else if (percentage >= 25 && percentage < 50) {
        document.getElementById(elementID).style.background = 'linear-gradient(#FF9700, #D67F00)';
    }
    else if (percentage >= 0 && percentage < 25) {
        document.getElementById(elementID).style.background = 'linear-gradient(#FF0000, #AF0000)';
    }
}
function changeHpBarColour ( percentage , elementID ) { if ( percentage >= 75 ) { document . getElementById ( elementID ) . style . background = 'linear-gradient(#33FF33, #27AD27)' ; } else if ( percentage >= 50 && percentage < 75 ) { document . getElementById ( elementID ) . style . background = 'linear-gradient(#FFFB00, #D6D300)' ; } else if ( percentage >= 25 && percentage < 50 ) { document . getElementById ( elementID ) . style . background = 'linear-gradient(#FF9700, #D67F00)' ; } else if ( percentage >= 0 && percentage < 25 ) { document . getElementById ( elementID ) . style . background = 'linear-gradient(#FF0000, #AF0000)' ; } }
Changes colour of the HP bar based on percentage of health remaining.
Changes colour of the HP bar based on percentage of health remaining .